<?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 Anjani Suman on Medium]]></title>
        <description><![CDATA[Stories by Anjani Suman on Medium]]></description>
        <link>https://medium.com/@anjanisuman?source=rss-4176df2e964d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jdQyNCRwsshDbf40.jpg</url>
            <title>Stories by Anjani Suman on Medium</title>
            <link>https://medium.com/@anjanisuman?source=rss-4176df2e964d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:24:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anjanisuman/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[Model Compression]]></title>
            <link>https://anjanisuman.medium.com/model-compression-a162f6c11dbb?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a162f6c11dbb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[model-compression]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Sun, 11 Dec 2022 09:19:44 GMT</pubDate>
            <atom:updated>2022-12-11T09:21:50.507Z</atom:updated>
            <content:encoded><![CDATA[<p>The process of making a model smaller is called model compression.</p><p>While there are many new techniques being developed, the four types of techniques that is often used is as follows:</p><ol><li><strong>Low-Rank Factorization</strong></li><li><strong>Knowledge Distillation</strong></li><li><strong>Pruning</strong></li><li><strong>Quantization</strong></li></ol><p>Let’s discuss about all these techniques in detail:</p><ol><li><strong>Low-Rank Factorization: </strong>The key idea behind low-rank factorization is to replace high-dimensional tensors with lower-dimensional tensors.</li></ol><p>2. <strong>Knowledge Distillation: </strong>It is a method in which a small model (student) is trained to mimic a larger or ensemble of models (teacher). The small model is what you’ll deploy.</p><p>3. <strong>Pruning: </strong>Pruning was a method originally used for decision trees where you remove sections of a tree that are uncritical and redundant for classification. As neural networks gained wider adopation, people started to realize that neural netwoks are over-parameterized and began to find a ways to reuce the workload caused by extra parameters.</p><p>4. <strong>Quantization: </strong>It is the most general and commonly used model compression method. It’s straightforward to do and generalizes over taks and architectures. Quantization reduces a model’s size by using fewer bits to represnet its parameters.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a162f6c11dbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[K-NN Algorithm From Scratch]]></title>
            <link>https://anjanisuman.medium.com/k-nn-algorithm-from-scratch-cd39fa5da211?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd39fa5da211</guid>
            <category><![CDATA[knn-algorithm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[knn]]></category>
            <category><![CDATA[knn-classification]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Sun, 17 Apr 2022 19:44:54 GMT</pubDate>
            <atom:updated>2022-04-17T19:44:54.620Z</atom:updated>
            <content:encoded><![CDATA[<p>This k-Nearest Neighbors tutorial is broken down into 3 parts:</p><p>Step 1: Calculate Euclidean Distance.</p><p>Step 2: Get Nearest Neighbors.</p><p>Step 3: Make Predictions.</p><p>Let’s discuss all of them in detail with python3 code.</p><p>Step-1: Calculation of Euclidean Distance</p><pre>def euclidean_distance(p1:list,p2:list) -&gt;float:</pre><pre>  distance = 0.0</pre><pre>  for i in range(len(p1)-1):</pre><pre>    distance += (p1[i]-p2[i])**2</pre><pre>  return math.sqrt(distance)</pre><p>This function calculates the Euclidean Distance.</p><p>Step-2:Get Nearest Neighbors.</p><pre># Locate the most similar neighbors</pre><pre>def get_neighbors(train:list, test:list , num_neighbours:int)-&gt;list:<br>  <br>  distance = list()</pre><pre>  for train_row in train:</pre><pre>    dist = euclidean_distance(train_row, test)<br>    #this is function which gets the euclidean distance</pre><pre>    distance.append((train_row,dist))</pre><pre>  distance.sort(key= lambda tup:tup[1])</pre><pre>  neighbors = list()</pre><pre>  for i in range(num_neighbors):</pre><pre>    neighbors.append(distance[i][0])</pre><pre>  return neighbors</pre><p>Step 3: Make Predictions.</p><pre># Make a classification prediction with neighbors</pre><pre>def predict_classification(train, test_row, num_neighbors):</pre><pre>  neighbors = get_neighbors(train, test_row, num_neighbors)</pre><pre>  output_values = [row[-1] for row in neighbors]</pre><pre>  prediction = max(set(output_values), key=output_values.count)</pre><pre>  return prediction</pre><p>These are the buliding blocks of K-NN algorithm. Try to run these functions and try to understand their use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd39fa5da211" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics Stats for EDA(Exploratory Data Analysis)]]></title>
            <link>https://anjanisuman.medium.com/basics-stats-for-eda-exploratory-data-analysis-cab07b8b58c7?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cab07b8b58c7</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[algebra]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Thu, 20 Jan 2022 17:48:26 GMT</pubDate>
            <atom:updated>2022-01-20T17:48:26.308Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Mean</li><li>Median</li><li>variance and standard deviation</li><li>Percentile and Quantile</li><li>IQR (Inter Quartile Range) and MAD (Median Absolute Deviation)</li></ol><p>Let’s understand all of them in detail:</p><ol><li>Mean: Mean gives as information about central tendency (Average value):</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*qH_vGzyCu_ZzksCOk_WS8A.png" /></figure><p>Problem with mean is that if any outlier present in data then it impact mean value.</p><p>2. Median : Median gives us the middle value from sample or population:</p><p>It’s also doesn&#39;t impact by outlier until and unless 50% of data contain outlier which is unlikely to be happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*FPIwjxVEmnW_bsxY4A3w8w.png" /></figure><p>3. Variance and Standard Deviation:</p><p>Variance: It gives us information about the data is how much deviated from mean. Also we take the square distance from mean to remove negative values. We can use absolute distance but this will not give the proper variance from mean.</p><p>Why do we need Standard Deviation if we have variance then?</p><p>To compare the results in same unit.</p><p>Example:</p><p>If the hight of student in cm then mean is in cm but the variance we get is in cm² because in formula we’re squaring the distance. But if we see the formula of standard deviation is square root then the std dev is also in cm. So both mean and std deviation is in same scale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*O0ICPOAAOY2GbPuQxy4hdw.png" /></figure><p>4. Percentile and Quantile:</p><p>Percentile:</p><p>The value below which a percentage of data falls.</p><p>Quantile:</p><p>which splits the data into quarters:</p><p>The Quartiles also divide the data into divisions of 25%, so:</p><ul><li>Quartile 1 (Q1) can be called the <strong>25th percentile</strong></li><li>Quartile 2 (Q2) can be called the <strong>50th percentile</strong></li><li>Quartile 3 (Q3) can be called the <strong>75th percentile</strong></li></ul><p>5. IQR (Inter Quartile Range) and MAD (Median Absolute Deviation)</p><p>IQR (Inter Quartile Range):</p><p>It’s the difference of (75th percentile — 25th percentile)</p><p>MAD (Median Absolute Deviation):</p><p>It’s same as variance but instead of mean we’re using median means we’re finding the deviation of data point from median instead of mean.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cab07b8b58c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Main Challenges of Machine Learning]]></title>
            <link>https://anjanisuman.medium.com/main-challenges-of-machine-learning-d2be48398438?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2be48398438</guid>
            <category><![CDATA[aritificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[challenge]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 12:06:48 GMT</pubDate>
            <atom:updated>2021-06-06T12:10:36.963Z</atom:updated>
            <content:encoded><![CDATA[<p>In short, since your main task is to select a learning algorithm and train it on some data, the two things that can go wrong are “bad algorithm” and “bad data.” Let’s start with examples of bad data.</p><ol><li>Insufficient Quantity of Training Data</li><li>Non-representative Training Data</li><li>Poor-Quality Data</li><li>Irrelevant Features</li></ol><p><strong>Bad Algorithm:</strong></p><ol><li>Overfitting the Training Data</li><li>Underfitting the Training Data</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2be48398438" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Machine Learning Systems:]]></title>
            <link>https://anjanisuman.medium.com/types-of-machine-learning-systems-8529ceb5b6f0?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8529ceb5b6f0</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 06:05:28 GMT</pubDate>
            <atom:updated>2021-06-06T06:05:28.859Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*YmX4IlkuHQkX79QyWqusuQ.jpeg" /></figure><p>There are so many different types of Machine Learning systems that is:</p><ol><li><strong>Supervised Learning</strong></li><li><strong>Unsupervised Learning</strong></li><li><strong>Semi-supervised learning</strong></li><li><strong>Reinforcement Learning</strong></li><li><strong>Batch learning</strong></li><li><strong>Online learning</strong></li><li><strong>Instance-based learning</strong></li><li><strong>Model-based learning</strong></li></ol><p>Let’s discuss each of them in detail:</p><ol><li><strong>Supervised Learning:</strong></li></ol><p>In supervised learning, the training data you feed to the algorithm includes the desired solutions, called labels.</p><p>A typical supervised learning task is classification. The spam filter is a good example of this: it is trained with many example emails along with their class (spam or ham), and it must learn how to classify new emails.</p><p>Another typical task is to predict a target numeric value, such as the price of a car, given a set of features (mileage, age, brand, etc.) called predictors. This sort of task is called regression. To train the system, you need to give it many examples of cars, including both their predictors and their labels (i.e., their prices).</p><p><strong>Here are some of the most important supervised learning algorithms:</strong></p><ul><li><strong>k-Nearest Neighbors</strong></li><li><strong>Linear Regression</strong></li><li><strong>Logistic Regression</strong></li><li><strong>Support Vector Machines (SVMs)</strong></li><li><strong>Decision Trees and Random Forests</strong></li><li><strong>Neural networks</strong></li></ul><p>2. <strong>Unsupervised Learning:</strong></p><p>In unsupervised learning, as you might guess, the training data is un-labelled. The system tries to learn without a teacher.</p><p>Here are some of the most important unsupervised learning algorithms:</p><ul><li><strong>Clustering:</strong></li></ul><p>— K-Means</p><p>— DBSCAN</p><p>— Hierarchical Cluster Analysis (HCA)</p><ul><li><strong>Anomaly detection and novelty detection:</strong></li></ul><p>— One-class SVM</p><p>— Isolation Forest</p><ul><li><strong>Visualization and dimensionality reduction:</strong></li></ul><p>— Principal Component Analysis (PCA)</p><p>— Kernel PCA</p><p>— Locally-Linear Embedding (LLE)</p><p>— t-distributed Stochastic Neighbor Embedding (t-SNE)</p><ul><li><strong>Association rule learning:</strong></li><li>— Apriori</li><li>— Eclat</li></ul><p><strong>3. Semi-supervised learning:</strong></p><p>Some algorithms can deal with partially labelled training data, usually a lot of unlabelled data and a little bit of labelled data. This is called semi-supervised learning.</p><p>Some photo-hosting services, such as Google Photos, are good examples of this. Once you upload all your family photos to the service, it automatically recognizes that the same person A shows up in photos 1, 5, and 11, while another person B shows up in photos 2, 5, and 7. This is the unsupervised part of the algorithm (clustering). Now all the system needs is for you to tell it who these people are. Just one label per person, and it is able to name everyone in every photo, which is useful for searching photos.</p><p>Most semi-supervised learning algorithms are combinations of unsupervised and supervised algorithms. For example, deep belief networks (DBNs) are based on unsupervised components called restricted Boltzmann machines (RBMs) stacked on top of one another. RBMs are trained sequentially in an unsupervised manner, and then the whole system is fine-tuned using supervised learning techniques.</p><p><strong>4. Reinforcement Learning:</strong></p><p>Reinforcement Learning is a very different beast. The learning system, called an agent in this context, can observe the environment, select and perform actions, and get rewards in return (or penalties in the form of negative rewards). It must then learn by itself what is the best strategy, called a policy, to get the most reward over time. A policy defines what action the agent should choose when it is in a given situation.</p><p>For example, many robots implement Reinforcement Learning algorithms to learn how to walk. DeepMind’s AlphaGo program is also a good example of Reinforcement Learning: it made the headlines in May 2017 when it beat the world champion Ke Jie at the game of Go. It learned its winning policy by analysing millions of games, and then playing many games against itself. Note that learning was turned off during the games against the champion; AlphaGo was just applying the policy it had learned.</p><p><strong>5. Batch learning:</strong></p><p>In batch learning, the system is incapable of learning incrementally: it must be trained using all the available data. This will generally take a lot of time and computing resources, so it is typically done offline. First the system is trained, and then it is launched into production and runs without learning anymore; it just applies what it has learned. This is called offline learning.</p><p>If you want a batch learning system to know about new data (such as a new type of spam), you need to train a new version of the system from scratch on the full dataset (not just the new data, but also the old data), then stop the old system and replace it with the new one.</p><p>This solution is simple and often works fine, but training using the full set of data can take many hours, so you would typically train a new system only every 24 hours or even just weekly. If your system needs to adapt to rapidly changing data (e.g., to predict stock prices), then you need a more reactive solution.</p><p>Also, training on the full set of data requires a lot of computing resources (CPU, memory space, disk space, disk I/O, network I/O, etc.). If you have a lot of data and you automate your system to train from scratch every day, it will end up costing you a lot of money. If the amount of data is huge, it may even be impossible to use a batch learning algorithm.</p><p>Fortunately, a better option in all these cases is to use algorithms that are capable of learning incrementally.</p><p><strong>6. Online learning:</strong></p><p>In online learning, you train the system incrementally by feeding it data instances sequentially, either individually or by small groups called mini-batches. Each learning step is fast and cheap, so the system can learn about new data on the fly, as it arrives Online learning is great for systems that receive data as a continuous flow (e.g., stock prices) and need to adapt to change rapidly or autonomously.</p><p>It is also a good option if you have limited computing resources: once an online learning system has learned about new data instances, it does not need them anymore, so you can discard them (unless you want to be able to roll back to a previous state and “replay” the data). This can save a huge amount of space.</p><p>Online learning algorithms can also be used to train systems on huge datasets that cannot fit in one machine’s main memory (this is called out-of-core learning). The algorithm loads part of the data, runs a training step on that data, and repeats the process until it has run on all of the data.</p><p><strong>Out-of-core learning is usually done offline (i.e., not on the live system), so online learning can be a confusing name. Think of it as incremental learning.</strong></p><p>One important parameter of online learning systems is how fast they should adapt to changing data: this is called the learning rate. If you set a high learning rate, then your system will rapidly adapt to new data, but it will also tend to quickly forget the old data (you don’t want a spam filter to flag only the latest kinds of spam it was shown). Conversely, if you set a low learning rate, the system will have more inertia; that is, it will learn more slowly, but it will also be less sensitive to noise in the new data or to sequences of nonrepresentative data points (outliers).</p><p><strong>Instance-Based Versus Model-Based Learning:</strong></p><p>One more way to categorize Machine Learning systems is by how they generalize. Most Machine Learning tasks are about making predictions. This means that given a number of training examples, the system needs to be able to generalize to examples it has never seen before. Having a good performance measure on the training data is good, but insufficient; the true goal is to perform well on new instances.</p><p>There are two main approaches to generalization: instance-based learning and model-based learning.</p><p><strong>7. Instance-based learning:</strong></p><p>Possibly the most trivial form of learning is simply to learn by heart. If you were to create a spam filter this way, it would just flag all emails that are identical to emails that have already been flagged by users — not the worst solution, but certainly not the best.</p><p>Instead of just flagging emails that are identical to known spam emails, your spam filter could be programmed to also flag emails that are very similar to known spam emails. This requires a measure of similarity between two emails. A (very basic) similarity measure between two emails could be to count the number of words they have in common. The system would flag an email as spam if it has many words in common with a known spam email.</p><p>This is called instance-based learning: the system learns the examples by heart, then generalizes to new cases by comparing them to the learned examples (or a subset of them), using a similarity measure. For example, in the new instance would be classified as a triangle because the majority of the most similar instances belong to that class.</p><p><strong>8. Model-based learning:</strong></p><p>Another way to generalize from a set of examples is to build a model of these examples, then use that model to make predictions. This is called model-based learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8529ceb5b6f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Regularization in Deep Learning]]></title>
            <link>https://medium.com/swlh/regularization-in-deep-learning-5a5943d9de3f?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a5943d9de3f</guid>
            <category><![CDATA[overfitting]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[regularization]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Mon, 01 Mar 2021 12:23:03 GMT</pubDate>
            <atom:updated>2021-03-01T12:25:07.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*pW-c72zc7NJeGMjzCMnVeQ.png" /></figure><p>There are 3 methods to avoid overfitting in Deep Learning:</p><ol><li>Regularization</li><li>Dropout</li><li>Early Stopping</li></ol><h4>In this blog I’m going to discuss only Regularization part next will discuss in another blog.</h4><h4><strong>What is Regularization?</strong></h4><p>Regularization is a way to prevent overfitting.</p><p>There are two most common types of regularization used in training deep learning models. Which is L1 and L2.</p><ul><li>General cost function with regularization for training is defined as:</li><li>Cost function = Loss + Regularization term</li><li>Due to this regularization term, the numerical values of weight decreases because it assumes that a neural network with smaller weights leads to simpler models.</li><li>So this helps to reduce overfitting.</li></ul><p><strong>Regularization: L1 &amp; L2:</strong></p><p><strong>L1 regularizer: Cost function = Loss + λ ∑|w|</strong></p><ul><li>It penalizes absolute value of weights</li><li>It can make some weight to zero. So useful for model compression.</li><li>λ is a regularization hyper parameter. Controls the relative weight.</li></ul><p><strong>L2 regularizer: Cost function = Loss + λ ∑||w||²</strong></p><ul><li>It penalizes second norm of weights.</li><li>It is also terms as weight decay as it pushes the weights near to zero. But it does not make exactly zero always.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a5943d9de3f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/regularization-in-deep-learning-5a5943d9de3f">Regularization in Deep Learning</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementation of LeNet From Scratch using Keras.]]></title>
            <link>https://anjanisuman.medium.com/implementation-of-lenet-from-scratch-using-keras-e2f7ca0ed961?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2f7ca0ed961</guid>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Thu, 17 Dec 2020 14:06:29 GMT</pubDate>
            <atom:updated>2020-12-17T14:06:29.173Z</atom:updated>
            <content:encoded><![CDATA[<p>Here in this blog, I’m going to discuss the code implementation of LeNet using Keras. In this, I used this research for <a href="http://yann.lecun.com/exdb/publis/pdf/lecun-98.pdf">http://yann.lecun.com/exdb/publis/pdf/lecun-98.pdf</a> for implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t4KqpO5GDx-QZa3e49wSjQ.png" /></figure><p>LeNet-5 Total seven-layer does not comprise an input, each containing trainable parameters; each layer has a plurality of the Map the Feature, a characteristic of each of the input FeatureMap extracted by means of a convolution filter, and then each FeatureMap There is multiple neurons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*TV4g-i0_Vvdq4c2iBCCUmA.png" /><figcaption>fig1. LeNet Research paper Arch</figcaption></figure><p><strong>Library Import</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*tAjj0jFE6WomFnlLj3DafQ.png" /></figure><p>Here this is basic import.</p><p><strong>Defining Architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*FVsZ-wpf4k8jURWqmdH0wA.png" /></figure><p>First, we define sequential layer here the layer is stack in the form Conv2D and MaxPool2D in repeated form. At last, I use the Dense layer before the dense layer Conv2D and MaxPool2D layer used for feature extraction, and this dense layer used for classification.</p><p>Here I did some changes in the activation function and input shape in the original paper they used tanh activation function and the input shape is 32*32. You can see the complete arch in fig1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*dinhTErUTyQWfG6ppjE6uA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*23tFpr96MnBckAP7MD5klw.png" /></figure><p>To get complete notebook use this link <a href="https://github.com/anjanimsp/LeNet_From_Scratch">https://github.com/anjanimsp/LeNet_From_Scratch</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2f7ca0ed961" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CNN (Convolutional Neural Network)]]></title>
            <link>https://anjanisuman.medium.com/cnn-convolutional-neural-network-15b5c95486b5?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/15b5c95486b5</guid>
            <category><![CDATA[aritificial-intelligence]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[convolutional-neural-net]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Thu, 24 Sep 2020 16:32:19 GMT</pubDate>
            <atom:updated>2020-09-24T16:32:19.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCc_2_wKmFL10ku52Zn3Kw.png" /></figure><p>Why CNN?</p><p>Convolution layers reduce the number of parameters and speed up the training of the model significantly.</p><p>CNN is basically a partially connected layer.</p><p>There are 3 types of layers in Convolutional Neural Network:</p><ol><li><strong>Convolutional Layer</strong></li><li><strong>Relu layer</strong></li><li><strong>Pooling Layer</strong></li></ol><p>Here I’m going to discuss all of 3 layers in detail:</p><ol><li><strong>Convolutional Layer:</strong></li></ol><p>The first layer on CNN is the convolutional layer. It applies a filter to input to create a feature map that summarizes the presence of detected features in the input.</p><p>In the convolutional layer, the image became the stack of the filtered images and the number of filtered images depends upon the number of filters.</p><p>2. <strong>Relu Layer:</strong></p><p>In this layer, we remove all the negative values from the filtered images and replace them with zero’s.</p><p>3. <strong>Pooling layer:</strong></p><p>The ultimate goal of the pooling layer is to reduce the size of the image.</p><p><strong>Fully Connected Layer:</strong></p><p>The fully connected layer, this is the layer where image classification actually happens.</p><p>Here we convert our filtered images into a 1-dimensional array.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15b5c95486b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Limitation of NN and CNN :]]></title>
            <link>https://anjanisuman.medium.com/limitation-of-nn-and-cnn-ee21a4cdc9eb?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee21a4cdc9eb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Thu, 24 Sep 2020 15:47:24 GMT</pubDate>
            <atom:updated>2020-09-24T16:00:48.510Z</atom:updated>
            <content:encoded><![CDATA[<h3>Limitation of Feed-Forward Neural Network and CNN :</h3><p><strong>Issues with Feed-Forward Neural Network:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*fo0ElcIL7bsQXNrzqeg1nA.jpeg" /><figcaption>Feed-Forward Neural Network</figcaption></figure><ol><li>Loss of neighborhood information.</li><li>More parameters to optimize.</li><li>It’s not Translation invariance</li></ol><p><strong>Issues with Convolutional Neural Network:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*ztvDwU6BjnZIIVQuIMa-kA.jpeg" /><figcaption>CNN</figcaption></figure><ol><li>CNN is a translation invariance but it’s not translation equivariance.</li><li>Compared to NN it having fewer parameters to train.</li></ol><p><strong>To overcome these limitations we use a capsule network i.e introduce by Geoffrey Hinton.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee21a4cdc9eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizers in Machine Learning]]></title>
            <link>https://ai.plainenglish.io/optimizers-27311545e625?source=rss-4176df2e964d------2</link>
            <guid isPermaLink="false">https://medium.com/p/27311545e625</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[optimizer]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <dc:creator><![CDATA[Anjani Suman]]></dc:creator>
            <pubDate>Sun, 30 Aug 2020 18:03:38 GMT</pubDate>
            <atom:updated>2020-09-05T16:25:47.544Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Optimizers</strong> are algorithms or methods used to change the attributes of the neural network such as weights and learning rates in order to reduce the losses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jf9nRhRFG6fi-8GD.gif" /></figure><p>Different types of optimizers:</p><ol><li>Batch Gradient Descent (BGD)</li><li>Stochastic gradient descent (SGD)</li><li>Mini-batch gradient descent (MBGD)</li><li>Adagrad</li><li>Adadelta</li><li>RMSProp</li><li>Adam</li></ol><p>Here I’m going to discuss all of them in detail:</p><ol><li><strong>Batch Gradient Descent (BGD):</strong></li></ol><p><strong>Gradient update rule:</strong><br>BGD uses the data of the entire training set to calculate the gradient of the cost function to the parameters.</p><p><strong>Disadvantages:</strong></p><p>Because this method calculates the gradient for the entire data set in one update, the calculation is very slow, it will be very tricky to encounter a large number of data sets, and you cannot invest in new data to update the model in real-time.</p><p><strong>Batch gradient descent can converge to a global minimum for convex functions and to a local minimum for non-convex functions.</strong></p><p><strong>2. Stochastic gradient descent (SGD) :</strong></p><p><strong>Gradient update rule:</strong><br>Compared with BGD’s calculation of gradients with all data at one time, SGD updates the gradient of each sample with each update.</p><p><strong>x +=-learning_rate * dx</strong></p><p>where x is a parameter, dx is the gradient and learning rate is constant</p><p>For large data sets, there may be similar samples, so BGD calculates the gradient. There will be redundancy, and SGD is updated only once, there is no redundancy, it is faster, and new samples can be added.</p><p><strong>Disadvantages:</strong><br>However, because SGD is updated more frequently, the cost function will have severe oscillations.<br>BGD can converge to a local minimum, of course, the oscillation of SGD may jump to a better local minimum.</p><p><strong>When we decrease the learning rate slightly, the convergence of SGD and BGD is the same.</strong></p><p><strong>3. Mini-batch gradient descent (MBGD) :</strong></p><p><strong>Gradient update rule:</strong></p><p>MBGD uses a small batch of samples, that is, n samples to calculate each time. In this way, it can reduce the variance when the parameters are updated, and the convergence is more stable.<br> It can make full use of the highly optimized matrix operations in the deep learning library for more efficient gradient calculations.</p><p>The difference from SGD is that each cycle does not act on each sample, but a batch with n samples.</p><p><strong>Setting the value of hyper-parameters: n Generally value is 50 ～ 256.</strong></p><p><strong>Disadvantages:</strong></p><p>Mini-batch gradient descent does not guarantee good convergence,</p><p>If the learning rate is too small, the convergence rate will be slow. If it is too large, the loss function will oscillate or even deviate at the minimum value.<br>One measure is to set a larger learning rate. When the change between two iterations is lower than a certain threshold, the learning rate is reduced.</p><p><strong>4. Adagrad:</strong></p><p>Adagrad is an algorithm for gradient-based optimization which adapts the learning rate to the parameters, using low learning rates for parameters associated with frequently occurring features, and using high learning rates for parameters associated with infrequent features.</p><p>So, it is well-suited for dealing with sparse data.</p><p>But the same update rate may not be suitable for all parameters. For example, some parameters may have reached the stage where only fine-tuning is needed, but some parameters need to be adjusted a lot due to the small number of corresponding samples.</p><p>Adagrad proposed this problem, an algorithm that adaptively assigns different learning rates to various parameters among them. The implication is that for each parameter, as its total distance updated increases, its learning rate also slows.</p><p><strong>GloVe word embedding uses adagrad where infrequent words required a greater update and frequent words require smaller updates.</strong></p><p><strong>Adagrad eliminates the need to manually tune the learning rate.</strong></p><p><strong>5. Adadelta :</strong></p><p>There are three problems with the Adagrad algorithm</p><p><strong>1. The learning rate is monotonically decreasing.<br>2. The learning rate in the late training period is very small.<br>3. It requires manually setting a global initial learning rate.</strong></p><p><strong>Adadelta is an extension of Adagrad and it also tries to reduce Adagrad’s aggressive, monotonically reducing the learning rate.</strong></p><p>It does this by restricting the window of the past accumulated gradient to some fixed size of w. Running average at time t then depends on the previous average and the current gradient.</p><p>In Adadelta we do not need to set the default learning rate as we take the ratio of the running average of the previous time steps to the current gradient.</p><p><strong>6. RMSProp :</strong></p><p>The full name of the RMSProp algorithm is called <strong>Root Mean Square Prop</strong>, which is an adaptive learning rate optimization algorithm proposed by Geoff Hinton.</p><p>RMSProp tries to resolve Adagrad’s radically diminishing learning rates by using a moving average of the squared gradient. It utilizes the magnitude of the recent gradient descents to normalize the gradient.</p><p>The difference is that RMSProp calculates the <strong>differential squared weighted average of the gradient</strong>. This method is beneficial to eliminate the direction of large swing amplitude and is used to correct the swing amplitude so that the swing amplitude in each dimension is smaller. On the other hand, it also makes the network function converge faster.</p><p>In RMSProp learning rate gets adjusted automatically and it chooses a different learning rate for each parameter.</p><p>RMSProp divides the learning rate by the average of the exponential decay of squared gradients.</p><p><strong>7. Adam :</strong></p><p><strong>Adaptive Moment Estimation (Adam)</strong> is another method that computes adaptive learning rates for each parameter. In addition to storing an exponentially decaying average of past squared gradients like Adadelta and RMSprop.</p><p>Adam also keeps an exponentially decaying average of past gradients, similar to momentum.</p><p>Adam can be viewed as a combination of Adagrad and RMSprop.</p><p>Adam implements the <strong>exponential moving average of the gradients</strong> to scale the learning rate instead of a simple average as in Adagrad. It keeps an exponentially decaying average of past gradients.</p><p>Adam is computationally efficient and has very little memory requirements.</p><p><strong>Adam optimizer is one of the most popular and famous gradient descent optimization algorithms.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27311545e625" width="1" height="1" alt=""><hr><p><a href="https://ai.plainenglish.io/optimizers-27311545e625">Optimizers in Machine Learning</a> was originally published in <a href="https://ai.plainenglish.io/">Artificial Intelligence in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>