<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhijeet Pujara on Medium]]></title>
        <description><![CDATA[Stories by Abhijeet Pujara on Medium]]></description>
        <link>https://medium.com/@abhijeetpujara?source=rss-208eacbb36e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wtmz_9FNZA5l0KfXmhJi1A.png</url>
            <title>Stories by Abhijeet Pujara on Medium</title>
            <link>https://medium.com/@abhijeetpujara?source=rss-208eacbb36e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:23:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhijeetpujara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Object segmentation with Mask R-CNN]]></title>
            <link>https://medium.com/analytics-vidhya/object-segmentation-with-mask-r-cnn-6e9c06cef81c?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e9c06cef81c</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mask-r-cnn]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Mon, 01 Jan 2024 17:21:03 GMT</pubDate>
            <atom:updated>2024-01-05T18:08:50.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*roPhH-aSYYzrE9Jhi03ZmA.png" /><figcaption>Image <a href="https://siliconvalley.basisindependent.com/2021/03/12/week-4-introduction-to-object-detection-mask-r-cnn-and-detectron2/">source</a></figcaption></figure><p>This article covers five parts of Mask R-CNN:</p><ol><li>What is Mask R-CNN?</li><li>Instance and Semantic Segmentation</li><li>How does Mask R-CNN work?</li><li>Mask R-CNN With Python</li><li>Applications, Advantages and Limitations of Mask R-CNN</li></ol><p>In this post, I’m assuming that you are comfortable with basic deep learning tasks and models specific to computer vision, such as convolutional neural networks (CNN), image classification, etc. Besides the traditional dog vs. cat classifier that most of us would have built on our deep learning journey, there is a whole lot more we can do with the very same idea of a neural network.</p><p>Anyway, in this post, we’ll dive into some of the more recent developments in computer vision with deep learning and eventually build up to a model called “Mask R-CNN.”</p><h3>What is Mask R-CNN?</h3><p><strong>The Mask R-CNN framework is built on top of Faster R-CNN to solve instance segmentation tasks. </strong>It is very similar to Faster R-CNN, except there is another layer to predict segmented. The stage of region proposal generation is the same in both architectures; the second stage, which works in parallel, predicts the class and generates a bounding box as well as outputs a binary mask for each RoI. So, let’s first quickly understand how faster R-CNN works.</p><ul><li>Faster R-CNN first uses a ConvNet to extract feature maps from the images.</li><li>These feature maps are then passed through a Region Proposal Network (RPN), which returns the candidate bounding boxes.</li><li>We then apply a RoI pooling layer to these candidate-bounding boxes to bring all the candidates to the same size.</li><li>And finally, the proposals are passed to a fully connected layer to classify and output the bounding boxes for objects.</li></ul><p>Most importantly, faster R-CNN was not designed for pixel-to-pixel alignment between network inputs and outputs. This is evident in how <a href="http://paperswithcode.com/method/roi-pooling">RoIPool</a>, the <em>de facto</em> core operation for attending to instances, performs coarse spatial quantization for feature extraction. To fix the misalignment, Mask R-CNN utilises a simple, quantization-free layer called <a href="http://paperswithcode.com/method/roi-align">RoIAlign</a>, that faithfully preserves exact spatial locations.</p><p>Secondly, Mask R-CNN <em>decouples</em> mask and class prediction: it predicts a binary mask for each class independently, without competition among classes, and relies on the network’s RoI classification branch to predict the category. In contrast, an <a href="http://paperswithcode.com/method/fcn">FCN</a> usually performs per-pixel multi-class categorization, which couples&#39; segmentation and classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*lEJBB6jMUhENOve7S6_K4Q.png" /></figure><p>The first step to understanding how Mask R-CNN works requires an understanding of the concept of image segmentation.</p><p>The computer vision task Image segmentation is the process of partitioning a digital image into multiple segments (sets of pixels, also known as image objects). This segmentation is used to locate objects and boundaries (lines, curves, etc.). There are two main types of image segmentation that fall under Mask R-CNN:</p><ol><li><strong>Semantic Segmentation</strong></li><li><strong>Instance Segmentation</strong></li></ol><h3><strong>Semantic Segmentation</strong></h3><p>Semantic segmentation classifies each pixel into a fixed set of categories without differentiating object instances. In other words, semantic segmentation deals with the identification and classification of similar objects as a single class at the pixel level.</p><p>An important thing to note is that semantic segmentation does not highlight individual instances of a class differently. For example, if there were three cows in an image, the model would highlight the area they occupied, but it would not be able to distinguish one cow from another. If we want to add this functionality, we need to extend the task and introduce another term to complicate the already enormously large vocabulary of deep learning—instance segmentation.</p><p>Ok, it wasn’t really all that bad, was it? The term is pretty much self-explanatory. Our goal is to segment or separate each “instance” of a class in an image. This should help you visualize what we are trying to achieve:</p><h3><strong>Instance Segmentation</strong></h3><p>Instance segmentation, or instance recognition, deals with the correct detection of all objects in an image while also precisely segmenting each instance. In other words, this type of segmentation goes further to give a clear distinction between each object classified as having similar instances. As shown in the example image, for instance, in segmentation, all objects are persons, but this segmentation process separates each person as a single entity. Semantic segmentation is otherwise known as foreground segmentation because it accentuates the subjects of the image instead of the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*G--wtU4lTYq7KRn5w9s2KQ.png" /></figure><h3>How does Mask R-CNN work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*lyc49V8jCCE-iJckJSvTSw.png" /></figure><p>Mask R-CNN was built using Faster R-CNN. While Faster R-CNN has two outputs for each candidate object: a class label and a bounding box offset, Mask R-CNN has the addition of a third branch that outputs the object mask. The additional mask output is distinct from the class and box outputs, requiring the extraction of a much finer spatial layout of an object.</p><p>It consists of:</p><ul><li><strong>Backbone Network</strong></li><li><strong>Region Proposal Network</strong></li><li><strong>RoI Align</strong></li></ul><h3><strong>Backbone Network</strong></h3><p>The authors of Mask R-CNN experimented with two kinds of backbone networks. The first is the standard ResNet architecture (ResNet-C4), and the other is ResNet with a feature pyramid network. The standard ResNet architecture was similar to that of Faster R-CNN, but ResNet-FPN has proposed some modifications. This consists of a multi-layer RoI generation. This multi-layer feature pyramid network generates RoIs of different scales, which improves the accuracy of the previous ResNet architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*28BJWpHJMeEON1-4jcRrdQ.png" /><figcaption><em>Mask R-CNN backbone architecture</em></figcaption></figure><h3>Region Proposal Network (RPN)</h3><p>The RPN is responsible for generating region proposals or candidate bounding boxes that might contain objects within the image. It operates on the feature map produced by the backbone network and proposes potential regions of interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*_6rBYHyKBHtn4ABGN9Uc-w.jpeg" /><figcaption><em>Region Proposal Network (RPN).</em></figcaption></figure><h3>ROIAlign</h3><p>After the RPN generates region proposals, the ROIAlign (Region of Interest Align) layer is introduced. This step helps to overcome the misalignment issue in ROI pooling.</p><p>ROIAlign plays a crucial role in accurately extracting features from the input feature map for each region proposal, ensuring precise pixel-wise segmentation in instance segmentation tasks.</p><p>The primary purpose of ROIAlign is to align the features within a region of interest (ROI) with the spatial grid of the output feature map. This alignment is crucial to prevent information loss that can occur when quantizing the ROI’s spatial coordinates to the nearest integer (as done in ROI pooling).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/0*JIExI0THjQRvIdFO" /><figcaption><em>ROIAlign operation.</em></figcaption></figure><p>The ROIAlign process involves the following steps:</p><ol><li><strong>Input Feature Map</strong>: The process begins with the input feature map, which is typically obtained from the backbone network. This feature map contains high-level semantic information about the entire image.</li><li><strong>Region Proposals</strong>: The Region Proposal Network (RPN) generates region proposals (candidate bounding boxes) that might contain objects of interest within the image.</li><li><strong>Dividing into Grids</strong>: Each region proposal is divided into a fixed number of equal-sized spatial bins, or grids. These grids are used to extract features from the input feature map corresponding to the region of interest.</li><li><strong>Bilinear Interpolation</strong>: Unlike ROI pooling, which quantizes the spatial coordinates of the grids to the nearest integer, ROIAlign uses bilinear interpolation to calculate the pooling contributions for each grid. This interpolation ensures a more precise alignment of the features within the ROI.</li><li><strong>Output Features</strong>: The features obtained from the input feature map, aligned with each grid in the output feature map, are used as the representative features for each region proposal. These aligned features capture fine-grained spatial information, which is crucial for accurate segmentation.</li></ol><p>By using bilinear interpolation during the pooling process, ROIAlign significantly improves the accuracy of feature extraction for each region proposal, mitigating misalignment issues.</p><p>This precise alignment enables Mask R-CNN to generate more accurate segmentation masks, especially for small objects or regions that require fine details to be preserved. As a result, ROIAlign contributes to the strong performance of Mask R-CNN in instance segmentation tasks.</p><h3>Mask R-CNN With Python</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*K23R9TsBVGnopzpyIUHIJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*f9IvIf-8bBafEUVKUNJWCw.png" /></figure><p><a href="https://colab.research.google.com/github/zaidalyafeai/Notebooks/blob/master/Mask_RCNN.ipynb">Google Colaboratory</a></p><h3>Applications of Mask R-CNN</h3><p>Due to its additional capability to generate segmented masks, it is used in many computer vision applications, such as:</p><ul><li>Human Pose Estimation</li><li>Self-driving car</li><li>Drone Image mapping, etc.</li></ul><h3><strong>Advantages of Mask R-CNN</strong></h3><ul><li><strong>Simplicity</strong>: Mask R-CNN is simple to train.</li><li><strong>Performance</strong>: Mask R-CNN outperforms all existing, single-model entries on every task.</li><li><strong>Efficiency</strong>: The method is very efficient and adds only a small overhead to faster R-CNN.</li><li><strong>Flexibility</strong>: Mask R-CNN is easy to generalize to other tasks. For example, it is possible to use Mask R-CNN for human pose estimation in the same framework.</li></ul><h3>Mask R-CNN Limitations</h3><ul><li><strong>Computational Complexity</strong>: Training and inference can be computationally intensive, requiring substantial resources, especially for high-resolution images or large datasets.</li><li><strong>Small-Object Segmentation</strong>: Mask R-CNN may struggle to accurately segment very small objects due to limited pixel information.</li><li><strong>Data Requirements</strong>: Training Mask R-CNN effectively requires a large amount of annotated data, which can be time-consuming and expensive to acquire.</li><li><strong>Limited Generalization to Unseen Categorie</strong>s: The model’s ability to generalize to unseen object categories is limited, especially when data is scarce.</li></ul><h3>Conclusion</h3><p>Mask R-CNN merges object detection and instance segmentation, providing the capability to not only detect objects but also to precisely delineate their boundaries at the pixel level. By using a feature pyramid network (FPN) and the region of interest align (ROIAlign), Mask R-CNN achieves strong performance and accuracy.</p><p>Mask R-CNN does have certain limitations, such as its computational complexity and memory usage during training and inference. It may encounter challenges in accurately segmenting very small objects or handling heavily occluded scenes. Acquiring a substantial amount of annotated training data can also be demanding, and fine-tuning the model for specific domains may require careful parameter tuning.</p><blockquote><em>Mask R-CNN Paper</em></blockquote><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//arxiv.org/pdf/1703.06870.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1ae5a44e6080091b6d893c4616dc1f4/href">https://medium.com/media/e1ae5a44e6080091b6d893c4616dc1f4/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4tkgOzQ9yyo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4tkgOzQ9yyo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F4tkgOzQ9yyo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/390c4a5f064877b28be522b398a9a4c7/href">https://medium.com/media/390c4a5f064877b28be522b398a9a4c7/href</a></iframe><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on Deep Learning algorithms</h3><ul><li><a href="https://builtin.com/machine-learning/mobilenet">Image Classification With MobileNet</a></li><li><a href="https://medium.com/analytics-vidhya/concept-of-alexnet-convolutional-neural-network-6e73b4f9ee30">Concept of AlexNet:- Convolutional Neural Network</a></li><li><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a></li><li><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a></li><li><a href="https://medium.com/analytics-vidhya/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a></li><li><a href="https://medium.com/analytics-vidhya/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a></li></ul><p><strong>Happy learning!!!</strong></p><p><strong>Happy coding!</strong></p><p>And don’t forget to clap, clap, clap...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*K6UvbyIDLKKzrnd8.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e9c06cef81c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/object-segmentation-with-mask-r-cnn-6e9c06cef81c">Object segmentation with Mask R-CNN</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concept of AlexNet:- Convolutional Neural Network]]></title>
            <link>https://medium.com/analytics-vidhya/concept-of-alexnet-convolutional-neural-network-6e73b4f9ee30?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e73b4f9ee30</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[alexnet]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Tue, 03 Nov 2020 13:02:17 GMT</pubDate>
            <atom:updated>2024-01-24T08:25:04.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*pJ3o_2zTTNnixhKH.png" /></figure><p>This article covers nine parts:</p><ol><li>What is AlexNet?</li><li>The Architecture of AlexNet.</li><li>Dataset.</li><li>ReLU.</li><li>Dropout.</li><li>Pros of AlexNet.</li><li>Cons of AlexNet.</li><li>AlexNet With Python.</li><li>Conclusion.</li></ol><h3>What is AlexNet?</h3><p><a href="https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf">AlexNet</a> is the name given to a <a href="https://www.analyticsvidhya.com/blog/2018/12/guide-convolutional-neural-network-cnn/"><strong>Convolutional Neural Network</strong></a><strong> Architecture</strong> that won the LSVRC competition in <strong>2012</strong>.</p><p>LSVRC<strong> (</strong>Large Scale Visual Recognition Challenge) is a competition where research teams evaluate their algorithms on a huge dataset of labeled images (<strong>ImageNet</strong>) and compete to achieve higher accuracy on several visual recognition tasks. This made a huge impact on how teams approach the completion afterward.</p><h3>The Architecture of AlexNet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*ecOq26xunjQ5jWTF.png" /></figure><p>The <strong>AlexNet contains 8 layers</strong> with weights;</p><p><strong>5 convolutional layers</strong></p><p><strong>3 fully connected layers</strong>.</p><p>At the end of each layer, ReLu activation is performed except for the last one, which outputs with a softmax with a distribution over the 1000 class labels. Dropout is applied in the first two fully connected layers. As the figure above shows also applies Max-pooling after the first, second, and fifth convolutional layers. The kernels of the second, fourth, and fifth convolutional layers are connected only to those kernel maps in the previous layer, which reside on the same GPU. The kernels of the third convolutional layer are connected to all kernel maps in the second layer. The neurons in the fully connected layers are connected to all neurons in the previous layer.</p><h3>Dataset</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*km4DulG98uH6g5kT.jpeg" /></figure><p><a href="http://image-net.org/">ImageNet </a>is an image database of over 15 million labeled high-resolution images labeled to 22,000 categories. This competition uses a subset of ImageNet’s images and challenges researchers to achieve the lowest top-1 and top-5 error rates. The input to AlexNet is an RGB image of size 256×256. This means all images in the training set and all test images need to be of size 256×256. Meaning, it needs to be converted to 256×256 before using it for training the network.</p><h3>ReLU</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*8sSgOQN8a-XPOMdd.png" /></figure><p>An important feature of the AlexNet is the use of ReLU(Rectified Linear Unit) Nonlinearity.</p><p>Tanh or sigmoid activation functions used to be the usual way to train a neural network model.</p><p>AlexNet showed that using ReLU nonlinearity, deep CNNs could be trained much faster than using the saturating activation functions like tanh or sigmoid.</p><p>Tested on the CIFAR-10 dataset.</p><p>Let&#39;s see why it trains faster with the ReLUs. The ReLU function is given by</p><p>f(x) = max(0,x)</p><p>plots of the two functions —</p><p><strong>1. tanh</strong></p><p><strong>2. ReLU.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*4oyP8c5Uqp-TL4C3.png" /><figcaption>image credits <a href="http://www.learnopencv.com/">www.learnopencv.com</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2cfozND0q0Auj2g9.png" /><figcaption>image credits <a href="http://www.learnopencv.com/">www.learnopencv.com</a></figcaption></figure><p>The tanh function saturates at very high or very low values of z. In these regions, the slope of the function goes very close to zero. This can slow down gradient descent.</p><p>The ReLU function’s slope is not close to zero for higher positive values of z. This helps the optimization to converge faster. For negative values of z, the slope is still zero, but most of the neurons in a neural network usually end up having positive values.</p><p><strong>ReLU wins over the sigmoid function, too, for the same reason.</strong></p><blockquote><strong>The Overfitting Problem.</strong> AlexNet had 60 million parameters, a major issue in terms of overfitting.</blockquote><p>Two methods to reduce overfitting:</p><ol><li><strong>Data Augmentation</strong></li><li><strong>Dropout.</strong></li></ol><h3><strong>Data Augmentation.</strong></h3><p>The authors generated image translations and horizontal reflections, which increased the training set by 2048. They also performed Principle Component Analysis (PCA) on the RGB pixel values to change RGB channels&#39; intensities, which reduced the top-1 error rate by more than 1%.</p><h3>Dropout</h3><p>The second technique that AlexNet used to avoid overfitting was a dropout. It consists of setting to zero the output of each hidden neuron with a probability of 0.5. The neurons which are “dropped out” in this way do not contribute to the forward pass and do not participate in <strong>backpropagation</strong>. So every time an input is presented, the neural network samples a different architecture. This technique consists of <strong>turning off </strong>neurons with a predetermined probability. This means that every iteration, the neurons “turned off” do not contribute to the forward pass and do not participate in backpropagation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*GVpofJTybmYuMYMN.gif" /></figure><h3>Pros of AlexNet</h3><ol><li>AlexNet isconsideredasthemilestoneofCNNforimageclassification.</li><li>Many methods, such as the conv+pooling design, dropout, GPU, parallel computing, ReLU, are still the industrial standard for computer vision.</li><li>TheuniqueadvantageofAlexNet is the direct image input to the classification model.</li><li>Theconvolutionlayerscanautomaticallyextracttheedgesoftheimages and fully connected layers learning these features</li><li>Theoreticallythecomplexityofvisualpatternscanbeeffectiveextractedbyaddingmoreconvlayer</li></ol><h3>Cons of AlexNet</h3><ol><li>AlexNet is NOT deep enough compared to the later model, such as VGGNet, GoogLENet, and ResNet.</li><li>The use of large convolution filters (5*5) is not encouraged shortly after that.</li><li>Use normal distribution to initiate the weights in the neural networks, can not effectively solve the problem of gradient vanishing, replaced by the Xavier method later.</li><li>The performance is surpassed by more complex models such as GoogLENet (6.7%), and ResNet (3.6%)</li></ol><h3>AlexNet With Python</h3><p><a href="https://github.com/abhijeetpujara/AlexNet">abhijeetpujara/AlexNet</a></p><h3>Conclusion</h3><p>AlexNet is a work of supervised learning and got excellent results.</p><p>It was also important for selecting methods like dropout and data augmentation that helped the network&#39;s performance.</p><p>The AlexNet made revolutionary implementation on ConvNets that continues nowadays, such as ReLU and dropout.</p><p>It is not easy to have low classification errors without having overfitting.</p><p><strong>For more clear understanding, please visit this video</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLkDaE6sCZn6Gl29AoE31iwdVwSG-KnDzF&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdZVkygnKh1M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdZVkygnKh1M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e05ca652968899f982e9cba74dae285c/href">https://medium.com/media/e05ca652968899f982e9cba74dae285c/href</a></iframe><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on machine learning algorithms</h3><ul><li><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a></li><li><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a></li><li><a href="https://medium.com/analytics-vidhya/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a></li><li><a href="https://medium.com/analytics-vidhya/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a></li><li><a href="https://medium.com/analytics-vidhya/image-classification-with-mobilenet-cc6fbb2cd470">Image Classification With MobileNet</a></li></ul><p><strong>Happy Learning !!!</strong></p><p><strong>Happy coding :)</strong></p><p>And Don’t forget to clap clap clap…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*lDdMocjqj7zXCOnk.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e73b4f9ee30" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/concept-of-alexnet-convolutional-neural-network-6e73b4f9ee30">Concept of AlexNet:- Convolutional Neural Network</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Naïve Bayes Algorithm With Python]]></title>
            <link>https://medium.com/analytics-vidhya/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b3aef57fb59</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-driven-investor]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[naive-bayes-classifier]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Thu, 28 May 2020 19:50:05 GMT</pubDate>
            <atom:updated>2024-01-01T17:18:41.306Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*LB-G6WBuswEfpg20FMighA.png" /></figure><p>This article covers five parts:</p><ol><li>What is a Naïve Bayes algorithm?</li><li>Naïve Bayes algorithm application</li><li>Pros of Naïve Bayes</li><li>Cons of Naïve Bayes</li><li>Naïve Bayes with <strong>python(<em>With code</em>)</strong></li></ol><h3>What is the NaïveBayes Algorithm?</h3><p>Naïve Bayes Algorithm is one of the popular <strong>classification </strong>machine learning algorithms and is included in <strong>supervised learning</strong>. that helps to classify the data based upon the conditional probability values computation. This algorithm is quite popular to be used in <strong>Natural Language Processing </strong>or NLP also real-time prediction, multi-class prediction, recommendation system, text classification, and sentiment analysis use cases. the algorithm is scalable and easy to implement for the large data set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*c3htQdfH1Ioi5FzzHVx04A.png" /><figcaption>Thomas Bayes</figcaption></figure><p>The algorithm based on <strong>Bayes theorem. </strong>Bayes Theorem helps us to find the probability of a hypothesis given our prior knowledge.</p><blockquote>Let’s look at the equation for Bayes Theorem,</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*21IgLSVommD1GAWLcdRdNA.png" /><figcaption>Bayes Theorem</figcaption></figure><p>Naïve Bayes is a simple but surprisingly powerful predictive modeling algorithm. Naïve Bayes classifier calculates the probabilities for every factor. Then it selects the outcome with the highest probability.</p><h3>Applications of Naïve Bayes Algorithm</h3><p><strong>1. Real-time prediction:</strong> Naïve Bayes Algorithm is fast and always ready to learn hence best suited for real-time predictions.</p><p><strong>2. Multi-class prediction:</strong> The probability of multi-classes of any target variable can be predicted using a Naïve Bayes algorithm.</p><p><strong>3</strong>. Text Classification where Naïve Bayes is mostly used is Spam Filtering in Emails (Naïve Bayes is widely used for text classification)</p><p><strong>4. Text classification/ Sentiment Analysis/ Spam Filtering:</strong> Due to its better performance with multi-class problems and its independence rule, Naïve Bayes algorithm perform better or have a higher success rate in text classification, Therefore, it is used in Sentiment Analysis and Spam filtering.</p><p><strong>5</strong>.<strong>Recommendation System: </strong>Naïve Bayes Classifier and <a href="https://en.wikipedia.org/wiki/Collaborative_filtering">Collaborative Filtering</a> together build a Recommendation System that uses machine learning and data mining techniques to filter unseen information and predict whether a user would like a given resource or not.</p><h3>Pros of Naïve Bayes</h3><ul><li>The assumption that all features are independent makes a Naïve Bayes algorithm <strong>very fast </strong>compared to complicated algorithms.<strong> </strong>In some cases, speed is preferred over higher accuracy.</li><li>For problems with a small amount of training data, it can achieve better results than other classifiers because it has a low propensity to overfit.</li><li>It works well with high-dimensional data such as text classification, email spam detection.</li><li>Less sensitive to missing data, the algorithm is also relatively simple, often used for text classification;</li><li>Naïve Bayes explains the results easily.</li></ul><h3>Cons of Naïve Bayes</h3><ul><li>The strong assumption about the features to be independent which is hardly true in real-life applications.</li><li>Naïve Bayes is the assumption of independent predictors. In real life, it is almost impossible that we get a set of predictors that are completely independent.</li><li>Chances of loss of accuracy.</li><li>If the categorical variable has a category in the test data set, which was not observed in the training data set, then the model will assign a 0 (zero) probability and will be unable to make a prediction. This is often known as <strong>Zero Frequency</strong>. To solve this, we can use the smoothing technique. One of the simplest smoothing techniques is called <strong>Laplace estimation</strong>.</li></ul><h3>Naïve Bayes With Python</h3><p><a href="https://github.com/Abhijeetap/Naive_Bayes_Algorithm_With_Python/blob/master/Naive%20Bayes%20Algorithm.ipynb">Abhijeetap/Naive_Bayes_Algorithm_With_Python</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*GAKoaI3F2TD2_5imK4Bk1A.png" /><figcaption>import data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*0awV6Y3x3sFp2sDhml-3kQ.png" /></figure><p>inputs.drop([‘Sex’,’male’],axis=’columns’,inplace=True)<br>inputs.head(3)</p><p>inputs.Age = inputs.Age.fillna(inputs.Age.mean())<br>inputs.head()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*TEwqB7hEKZv7ckRr7Egt_A.png" /><figcaption>Import Naive Bayes &amp; output</figcaption></figure><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on machine learning algorithms</h3><ul><li><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a></li><li><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a></li><li><a href="https://medium.com/@abhi.pujara97/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a></li></ul><p><strong>Happy Learning!!!</strong></p><p><strong>Happy coding :)</strong></p><p>And don’t forget to clap clap clap…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*XBWI6eNVLS_70s1qS46E1w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b3aef57fb59" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[K-Nearest Neighbors algorithm (KNN) With Python]]></title>
            <link>https://medium.com/analytics-vidhya/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e570f6bb8aed</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[k-nearest-neighbours]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[knn-algorithm]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Sun, 10 May 2020 09:39:48 GMT</pubDate>
            <atom:updated>2020-06-23T04:45:51.100Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWe5iOQaFBGdH1qRk8jVUA.png" /><figcaption>k-nearest neighbor</figcaption></figure><p>This article covers six parts:</p><ol><li>What is K-Nearest Neighbor (K-NN)?</li><li>To find “K” in k Nearest Neighbor?</li><li>distance functions</li><li>Pros K-Nearest Neighbor</li><li>Cons of K-Nearest Neighbor</li><li>K-Nearest Neighbor with <strong>Python</strong>(<strong><em>With code</em></strong>)</li></ol><p>In this article, we will explore and also see the <em>code </em>of the famous <strong>supervised machine learning algorithm,</strong> “K-Nearest Neighbor .” that can be used to solve both <strong>classification </strong>and <strong>regression </strong>problems.</p><h3>What is K-Nearest Neighbor?</h3><p>K- Nearest Neighbors is a</p><p>K-nearest neighbors (kNN) is a supervised machine learning algorithm that can be used to solve both classification and regression tasks. The algorithm makes predictions by calculating the similarity between the input sample and each training instance. In K-NN algorithm output is a class membership. Intuitively K is always a positive integer.K-nearest neighbor algorithm essentially boils down to forming a majority vote between the K most similar instances to a given “unseen” observation. The similarity is defined according to a distance metric between two data points.</p><blockquote>The following two properties would define KNN well:-</blockquote><p><strong>Lazy learning algorithm:- </strong>KNN is a lazy learning algorithm because it does not have a specialized training phase and uses all the data for training while classification.</p><p><strong>Non-parametric learning algorithm:- </strong>KNN is also a non-parametric learning algorithm because it doesn’t assume anything about the underlying data</p><h3>How to find the best k value</h3><p>The choice of “K” has a drastic impact on the results we obtain from KNN. “K” is a number used to identify similar neighbors for the new data point. “k” in the KNN algorithm is based on feature similarity</p><p>choosing the right value of “K” is a process called parameter tuning and is important for better accuracy. Finding the value of “k” is not easy.</p><h3>Some frequently used distance functions are</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*PAkBztaaau_QMEQ9o-4ZDg.png" /><figcaption>Manhattan &amp; Minkowski (Distance Measures)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*q88c7dFfrDuxFnCpy5iL7Q.png" /><figcaption>Euclidean(Distance Measures)</figcaption></figure><h3>Pros o<strong>f KNN</strong></h3><ol><li>KNN is very <strong>easy to implement</strong>. There are only two parameters required to implement KNN</li><li>Since the KNN algorithm requires no training before making predictions, <strong>new data can be added seamlessly</strong> which will not impact the accuracy of the algorithm.</li><li><strong>No Training Period:</strong> KNN is called <strong>Lazy Learner (Instance-based learning)</strong>. It does not learn anything in the training period</li></ol><h3>Cons of<strong> KNN</strong></h3><p><strong>1. It does not work well with the large dataset</strong>.</p><p><strong>2. </strong>The KNN algorithm doesn’t work well with high dimensional data because, with a large number of dimensions, it becomes difficult for the algorithm to calculate the distance in each dimension.</p><p><strong>3. Need feature scaling:</strong> We need to do feature scaling (standardization and normalization) before applying the KNN algorithm to any dataset. If we don’t do so, KNN may generate wrong predictions.</p><p><strong>4. </strong>KNN is sensitive to noise in the dataset. We need to manually impute missing values and remove outliers.</p><h3>KNN With Python</h3><p><a href="https://github.com/Abhijeetap/K-Nearest_Neighbor_algorithm_with_python/blob/master/k-NN%20(k-Nearest%20Neighbors).ipynb">Abhijeetap/K-Nearest_Neighbor_algorithm_with_python</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*PHZQ7-Vq5YKtwZAFT2yaCg.png" /><figcaption>iris dataset</figcaption></figure><p>iris_data.target_names</p><p>X=iris.values[:,0:4]<br>Y=iris.values[:,4]<br>x_train,x_test,y_train,y_test=train_test_split(X,Y,test_size=0.2,random_state=47)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*Y16pxA6htsp-yXgeOQOhRw.png" /><figcaption>K-NN</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*3vDAzJUvs59RyFgMiavdPA.png" /><figcaption>output</figcaption></figure><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on machine learning algorithms</h3><ul><li><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a></li><li><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a></li><li><a href="https://medium.com/@abhijeetPujara/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a></li></ul><p><strong>Happy Learning !!!</strong></p><p><strong>Happy coding :)</strong></p><p>And Don’t forget to clap clap clap…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*XBWI6eNVLS_70s1qS46E1w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e570f6bb8aed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the Support Vector Machine (SVM)]]></title>
            <link>https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc89207c011</guid>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[svm]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 21:31:20 GMT</pubDate>
            <atom:updated>2020-06-22T14:46:25.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5vvolpHe2P9SKO42615yA.png" /></figure><h3>Support Vector Machine (SVM) With Python</h3><p>This article covers eight parts:</p><ol><li>What is the support vector machine?</li><li>About Hyperplane.</li><li>How does it work in linear separable</li><li>How does it work in linear non-separable</li><li>Advantages of Support Vector Machine (SVM)</li><li>Disadvantages of Support Vector Machine (SVM)</li><li>Applications of Support Vector Machine (SVM)</li><li>Support Vector Machine with <strong>Python</strong> (<strong><em>with code</em></strong>)</li></ol><h3><strong>What is the support vector machine </strong>Algorithm?</h3><p>Support Vector Machine (SVM) is a supervised machine learning algorithm. That can be employed for both <strong>classification </strong>and <strong>regression </strong>purposes.</p><p>It uses a technique called the kernel trick to transform your data and then based on these transformations. It finds an optimal boundary between the possible outputs. Simply put, it does some extremely complex data transformations, then figures out how to separate your data based on the labels or outputs you’ve defined.</p><p>The learning of the hyperplane in linear SVM is done by transforming the problem using some linear algebra, which is out of the scope of this introduction to SVM.</p><p>A powerful insight is that the linear SVM can be rephrased using the inner product of any two given observations, rather than the observations themselves. The inner product between two vectors is the sum of the multiplication of each pair of input values</p><p>They are especially effective at <strong>classification, numeral prediction, and pattern recognition</strong> <strong>tasks</strong></p><h3>HYPERPLANE</h3><p><strong><em>A hyperplane in an n-dimensional Euclidean space is a flat, n-1 dimensional subset of that space that divides the space into two disconnected parts.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*b53I1ppwGfaCZ0xBnlnKMQ.png" /><figcaption><strong>HYPERPLANE 2D &amp; 3D</strong></figcaption></figure><p><strong>Example</strong></p><p>The line is our one-dimensional Euclidean space(i.e., let’s say our datasets lie on a line). Now pick a point on the line. This point divides the line into two parts. The line has one dimension, while the point has 0 dimensions. So a point is a hyperplane of the line.</p><p>For two dimensions, we saw that the separating line was the hyperplane. Similarly, for three dimensions, a plane with two dimensions divides the 3d space into two parts and thus acts as a hyperplane. Thus for a space of n dimensions, we have a hyperplane of n-1 dimensions separating it into two parts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*EATMA3_eq8vYpcJT8J8d8A.png" /><figcaption>Hyperplane can be written mathematically a 2-dimensional</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*Rdub8N6KYuM1TpxVg5UqRw.png" /><figcaption>For a 2-dimensional</figcaption></figure><h3>linear separable cases</h3><p>We assume a binary classification. The intuition of SVM is to put a hyperplane in the middle of the two classes so that the distance to the nearest positive or negative example is maximized.</p><p>The SVM discriminant function has the form</p><p><strong>f(x) = w &gt;x + b</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*PKhanL9Xlm05PWvkpMyVfA.png" /><figcaption>linear separable</figcaption></figure><h3>linear non-separable</h3><p>In the linearly separable case, SVM is trying to find the hyperplane that maximizes the Margin, with the condition that both classes are classified correctly. But in reality, datasets are probably never linearly separable, so the condition of 100% correctly classified by a hyperplane will never be met.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*JjH3BKCz9uMSRilFeKfXdw.png" /><figcaption>linear non-separable</figcaption></figure><p>SVM address non-linearly separable cases by introducing two concepts: <strong>Soft Margin </strong>and <strong>Kernel Tricks.</strong></p><ul><li><strong>Soft Margin: </strong>try to find a line to separate, but tolerate one or few misclassified dots</li><li><strong>Kernel Trick: </strong>try to find a non-linear decision boundary</li></ul><p>Recall that in the linearly separable (or soft margin) case, the SVM algorithm works by finding a separation boundary that maximizes the Margin, which is the <em>distance</em> between the boundary and the points closest to it. The distance here is the usual straight line distance between the boundary and the closest point(s). This is called the <a href="https://en.wikipedia.org/wiki/Euclidean_distance">Euclidean distance</a> in honor of the great geometer of antiquity. The point to note is that this process results in a separation boundary that is a straight line, which, as Figure 5 illustrates, does not always work. In fact, in most cases, it won’t.</p><h3><strong>Advantages of Support Vector Machine (SVM)</strong></h3><ol><li>SVM can be used to solve both <strong>classification </strong>and <strong>regression </strong>problems. SVM is used for classification problems while <strong>SVR (Support Vector Regression)</strong> is used for regression problems.</li><li><strong>Handles non-linear data efficiently:</strong> SVM can efficiently handle non-linear data using the Kernel trick.</li><li>It uses a subset of training points in the decision function (called support vectors), so it is also memory efficient.</li><li>SVM is suited for extreme case binary classification.</li><li>A small change to the data does not greatly affect the hyperplane and hence the SVM. So the SVM model is stable.</li><li>SVM is more effective in high dimensional spaces.</li><li>SVM’s are very good when we have no idea about the data. or we can say., If you are working with the <strong>unbalanced data</strong> then <strong>SVM is good.</strong></li><li>It is effective in cases where the number of dimensions is greater than the number of samples.</li><li>The hyperplane is affected by only the support vectors thus outliers have less impact.</li><li>Best algorithm when classes are separable.</li></ol><h3><strong>Disadvantages of Support Vector Machine (SVM)</strong></h3><ol><li>Choosing an appropriate Kernel function (to handle the non-linear data) is not an easy task. It could be tricky and complex. In case of using a high dimension Kernel, you might generate too many support vectors which reduce the training speed drastically.</li><li>For a larger dataset, it requires a large amount of time to process.</li><li>Algorithmic complexity and memory requirements of SVM are very high. You need a lot of memory since you have to store all the support vectors in the memory and this number grows abruptly with the training dataset size.</li><li>As the support vector classifier works by putting data points, above and below the classifying hyperplane there is no probabilistic explanation for the classification.</li><li>It does not perform well in case of overlapped classes.</li><li>The SVM model is difficult to understand and interpret by human beings, unlike Decision Trees.</li><li>SVM does not perform very well when the data set has more noise i.e. target classes are overlapping.</li></ol><h3><strong>Applications of Support Vector Machine (SVM)</strong></h3><ol><li>Almost all the applications where ANN is used.</li><li>Handwriting Recognition.</li><li>Breast Cancer Diagnosis.</li><li>Text and hypertext categorization.</li><li>Detecting Steganography in digital images.</li></ol><h3>SVM With Python</h3><p><a href="https://github.com/Abhijeetap/Support_Vector_Machines_with_python/blob/master/svm.ipynb">Abhijeetap/Support_Vector_Machines_with_python</a></p><p>df[df.target==1].head()</p><p>df[df.target==2].head()</p><p>df[‘flower_name’] =df.target.apply(lambda x: iris.target_names[x])<br>df.head()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*IAHVbOcGfRn85uGEyIQ7Ng.png" /></figure><p>plt.xlabel(‘Sepal Length’)<br>plt.ylabel(‘Sepal Width’)<br>plt.scatter(df0[‘sepal length (cm)’], df0[‘sepal width (cm)’],color=”green”,marker=’+’)<br>plt.scatter(df1[‘sepal length (cm)’], df1[‘sepal width (cm)’],color=”blue”,marker=’.’)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*rgAogHr7NoN2Tam8jiBAtw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*eE_AnLATB2H7FcKCpfGdnw.png" /></figure><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on machine learning algorithms</h3><ul><li><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a></li><li><a href="https://medium.com/@abhi.pujara97/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a></li><li><a href="https://medium.com/@abhijeetPujara/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a></li></ul><p><strong>Happy Learning !!!</strong></p><p><strong>Happy coding :)</strong></p><p>And Don’t forget to clap clap clap…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*XBWI6eNVLS_70s1qS46E1w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc89207c011" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Random forest Algorithm With Python]]></title>
            <link>https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47?source=rss-208eacbb36e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ccfbe9bcb47</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[random-forest]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Abhijeet Pujara]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 21:05:30 GMT</pubDate>
            <atom:updated>2020-06-22T14:48:26.485Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWwRzEmc3jzNTzutLlu29w.jpeg" /></figure><p>This article covers four parts:</p><ol><li>What is a Random Forest?</li><li>Random Forest algorithm Application.</li><li>Advantages of Random Forest</li><li>Random Forest with <strong>Python </strong>(<strong><em>with code</em></strong>)</li></ol><p>In this article, we will explore and also see the code of the famous <strong>supervised machine learning algorithm,</strong> “Random Forests.”</p><h3>What is a Random Forest?</h3><p>Random forests are <strong>bagged decision tree</strong> models that split on a <strong>subset of features</strong> on each split. Random forest is different from the vanilla bagging in just one way. It uses a modified tree learning algorithm that inspects, at each division in the learning process, <strong>a random subset of the features</strong>. We do so to avoid the correlation between the trees. Suppose that we have a powerful predictor in the data set along with several other moderately strong predictors. In the collection of bagged trees, most or all of our decision trees will use the powerful predictor for the first split! All bagged trees will look similar. Hence all the predictions from the bagged trees will be highly correlated. Correlated<br>predictors cannot help in improving the accuracy of prediction. By taking a random subset of features, Random Forests systematically avoids correlation and enhances the model’s performance. The example below illustrates how the Random Forest algorithm works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*zbWrkuPSPvwKY1_EEEDI5Q.png" /></figure><h3>Random Forest algorithm Application.</h3><p>In e-commerce, the Random Forest algorithm can be used for predicting whether the customer will like the recommend products based on the experience of similar customers.</p><p>In the stock market, the Random Forest algorithm can be used to identify a stock’s behavior and the expected loss or profit.</p><p>In medicine, the Random Forest algorithm can be used to both identify the correct combination of components and to identify diseases by analyzing the patient’s medical records.</p><h3>Advantages of Random Forest</h3><p><strong>1.</strong> Random Forest is based on the <strong>bagging</strong> algorithm and uses the <strong>Ensemble Learning</strong> technique. It creates as many trees on the subset of the data and combines the output of all the trees. In this way, it <strong>reduces overfitting</strong> problem in decision trees and also<strong> reduces the variance </strong>and therefore <strong>improves the accuracy</strong>.</p><p><strong>2.</strong> Random Forests can be used to <strong>solve both classifications as well as regression problems</strong>.</p><p><strong>3.</strong> Random Forest works well with both <strong>categorical and continuous variables</strong>.</p><p><strong>4.</strong> Random Forest can automatically <strong>handle missing values</strong>.</p><p><strong>5. No feature scaling required:</strong> No feature scaling (standardization and normalization) needed in the case of Random Forest as it uses a rule-based approach instead of distance calculation.</p><p><strong>6. Handles non-linear parameters efficiently:</strong> Non-linear parameters don’t affect the performance of a Random Forest, unlike curve based algorithms. So, if there is high non-linearity between the independent variables, Random Forest may outperform as compared to other curve-based algorithms.</p><p><strong>7.</strong> Random Forest can automatically <strong>handle missing values</strong>.</p><p><strong>8.</strong> Random Forest is usually <strong>robust to outliers</strong> and can handle them automatically.</p><p><strong>9.</strong> Random Forest is comparatively <strong>less impacted by noise</strong>.</p><h3>Random Forest With Python</h3><p><a href="https://github.com/Abhijeetap/Random-forest-Algorithm-With-Python/blob/master/RandomForest.ipynb">Abhijeetap/Random-forest-Algorithm-With-Python</a></p><p>df[‘target’] = digits.target<br>df[0:12]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*bVZNIA6Fy9zmLs7h3f22iw.png" /><figcaption>df[0:12]</figcaption></figure><p>#result of data<br>model.score(X_test, y_test)</p><p><strong>0.9555555555555556</strong></p><p>%matplotlib inline<br>import matplotlib.pyplot as plt<br>import seaborn as sn<br>plt.figure(figsize=(10,7))<br>sn.heatmap(cm, annot=True)<br>plt.xlabel(‘Predicted’)<br>plt.ylabel(‘Truth’)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*5siMJ-4wuoIQ6MtlMDWVsw.png" /></figure><p>Thank you for reading. Please let me know if you have any feedback.</p><h3>My other posts on machine learning algorithms</h3><ul><li><a href="https://medium.com/analytics-vidhya/what-is-the-support-vector-machine-svm-dc89207c011">What is the Support Vector Machine (SVM)</a></li><li><a href="https://medium.com/@abhi.pujara97/k-nearest-neighbors-algorithm-knn-with-python-e570f6bb8aed">K-Nearest Neighbors algorithm (KNN) With Python</a></li><li><a href="https://medium.com/@abhijeetPujara/na%C3%AFve-bayes-algorithm-with-python-7b3aef57fb59">Naïve Bayes Algorithm With Python</a></li></ul><p><strong>Happy Learning !!!</strong></p><p><strong>Happy coding :)</strong></p><p>And Don’t forget to clap clap clap…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*XBWI6eNVLS_70s1qS46E1w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ccfbe9bcb47" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/random-forest-algorithm-with-python-7ccfbe9bcb47">Random forest Algorithm With Python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>