<?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[Delta Force - Medium]]></title>
        <description><![CDATA[The Programming Club of NIT Trichy. We are a bunch of passionate developers, here to share our enthusiasm for coding with the world! - Medium]]></description>
        <link>https://medium.com/delta-force?source=rss----b1bcd9f7878---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Delta Force - Medium</title>
            <link>https://medium.com/delta-force?source=rss----b1bcd9f7878---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 01:14:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/delta-force" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Journey through Random Forests]]></title>
            <link>https://medium.com/delta-force/journey-through-random-forests-ab8f34fafdb6?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab8f34fafdb6</guid>
            <category><![CDATA[random-forest]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Karthik Sundar]]></dc:creator>
            <pubDate>Mon, 14 Feb 2022 09:44:41 GMT</pubDate>
            <atom:updated>2022-02-14T09:44:41.110Z</atom:updated>
            <content:encoded><![CDATA[<p>Random Forest is a machine learning algorithm used widely in classification and regression problems. As the name says, a random forest is a collection of decision trees. A decision tree performs very well on the data it is trained on, however, it performs poorly when we use it on test data. Thus we bring in some randomness into the process of building them and we also build several of them.</p><h4>Steps to build a Random Forest</h4><ol><li>From the original dataset, we create a bootstrapped dataset. We randomly select the entries from the original dataset and we are allowed to have duplicate entries in the bootstrapped dataset. In ML lingo, this process is called “<strong>bagging</strong>”.</li><li>Now we build a decision tree based on the bootstrapped dataset. Unlike in the case of decision trees, we choose two features at random when we want to branch.</li><li>We repeat the first two steps several times, to build our forest.</li></ol><h4>Working of a Random Forest</h4><p>We run our new sample in every tree and then we take the output which is said by the majority of the trees. To evaluate our random forest, we can use the samples which were not selected in step 1. These samples are called out-of-bag samples.</p><h4>How to deal with missing data?</h4><p>There are two types of missing data,</p><ol><li>Missing Data in the original dataset used to create the random forest.</li><li>Missing Data in the new sample that you want to categorize.</li></ol><p>So when we have missing data in our original dataset, we make a guess and then we try to refine the guess. In the case of a categorical type of data, we first look at the other data points having the same target value. Then we choose the category which has occurred a lot. In the case of a numerical type of data, we instead take the median of the data. However, there are also other ways to deal with missing data in the original dataset. Now that we have filled the data, to refine the data we use something called a proximity matrix.</p><p>A proximity matrix is a two-dimensional grid, describing the similarity of two data points. Whenever two data points end on the same leaf node of a decision tree, we add 1 to the respective cells. In the end, we divide every value in the matrix by the total number of trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*N2MhwAqerNc0Au0f-1FFsQ.png" /></figure><p>Now based on this matrix, we refine our guesses. For categorical data, we take the proportion of occurrence and multiply it by the weight of the data to get the weighted frequency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtcMTpjzu8i2JInwfTf43w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7zRWlWvfqNiOEfPjPg-bw.png" /></figure><p>Let&#39;s say we already built the random forest and our new data has some missing values. In this case, we make a copy of the data for each target value.</p><p>Then we find the values for the missing variable using the proximity matrix. After doing this, we run both sets of values in all the trees and take the output which we get from the majority of the trees.</p><h3>Project: Heart Attack Prediction</h3><p>Now, let’s do a small project using a random forest classifier. First, we need to download the dataset from Kaggle. You can download it <a href="https://www.kaggle.com/yasserh/heart-disease-dataset">here</a>.</p><p>After we have our dataset, let’s open a Jupyter notebook and start writing code.</p><p>First, let’s import the needed libraries and read the CSV file,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6ad2baf54010facaa28f71073b9eabb/href">https://medium.com/media/d6ad2baf54010facaa28f71073b9eabb/href</a></iframe><p>Let’s start looking into the data frame,</p><p>We check for any duplicated values in the dataset.</p><pre>df[df.duplicated()]</pre><p>We get the following output, indicating that there is a duplicate row</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*e5RZ2iZ0ceIMZGkgYLuEYA.png" /></figure><p>Now, we have to delete that row,</p><pre>updated_df = df.drop(164)</pre><p>Now, our next step is to split the dataset into testing and training datasets. We decide to use 30% of the data as testing data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d50cac281ffb7e34b0b5bd9cafc477df/href">https://medium.com/media/d50cac281ffb7e34b0b5bd9cafc477df/href</a></iframe><p>Now we use the random classifier model from Sklearn,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f3a90a6a9dfbd4460a621a637e167f9/href">https://medium.com/media/5f3a90a6a9dfbd4460a621a637e167f9/href</a></iframe><p>From the output we can see that our model performed with an 87% accuracy, let’s try to increase accuracy by changing the number of trees in our forest</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/592e28a0ff852c324a8e0175e50c900b/href">https://medium.com/media/592e28a0ff852c324a8e0175e50c900b/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*SAxOywkIw2_jTdvjyt-f_A.png" /></figure><p>From the output graph, we can see that our accuracy peaks around 107 trees.</p><p>The thing here is, as these trees are random, they tend to show different graphs each time we run. Thus, it is a hard thing to get right.</p><h3>Building a Random Forest From Scratch</h3><p>To build our tree, we will need the mathematical formulas for Entropy and Information Gain,</p><p>In the case of Binary Classification, we can say that entropy is as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*PFhMsQpqfwUt_38DV3m5Pw.png" /></figure><p>From Entropy, we calculate another important parameter called information gain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*X_47Rry_r3eRqWRt2oox3A.png" /></figure><p>Now it’s time to get to code,</p><p>First, let&#39;s code the functions to calculate Entropy and Information Gain</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/213d3cab8c761d0e91b6051d977292b6/href">https://medium.com/media/213d3cab8c761d0e91b6051d977292b6/href</a></iframe><p>Now our next step is to generate our bootstrapped dataset from the given dataset.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d53acabb0b599945bbd794f0247201d/href">https://medium.com/media/2d53acabb0b599945bbd794f0247201d/href</a></iframe><p>We have also added a helper function to calculate the out-of-bag score to evaluate our tree.</p><p>Next, we need a function to split the tree at specific values of random features.</p><p>So we will define a function to select features at random and for each feature, find the information gained for each value in the selected features. Finally, we return a dictionary which is basically our node in the tree consisting of:</p><ul><li>the feature index</li><li>the value to split at</li><li>Left child node</li><li>Right child node</li></ul><p>We also need a function to decide when to stop splitting the node. We check whether the right child or left child has 0 observations, if that’s the case, we have a terminal node. We also have a terminal node, if we reached the max_depth. We also check if the right child or left child has reached min_samples_split</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a3f63c32d51db1e2e0d7a0aff4f9d8f/href">https://medium.com/media/3a3f63c32d51db1e2e0d7a0aff4f9d8f/href</a></iframe><p>Our next step is to build our forest.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/614b4b45c0d1ebb3a9f9cea588ece624/href">https://medium.com/media/614b4b45c0d1ebb3a9f9cea588ece624/href</a></iframe><p>Thus, we have built a random forest from scratch.</p><p>Hope you guys enjoyed the article!</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab8f34fafdb6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/journey-through-random-forests-ab8f34fafdb6">Journey through Random Forests</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rooting & Custom Roms— Part 1]]></title>
            <link>https://medium.com/delta-force/rooting-custom-roms-part-1-56aff6094388?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/56aff6094388</guid>
            <category><![CDATA[android-root]]></category>
            <category><![CDATA[modding]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[custom-rom]]></category>
            <category><![CDATA[magisk]]></category>
            <dc:creator><![CDATA[Akash Jaiswal]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 12:01:59 GMT</pubDate>
            <atom:updated>2022-02-03T12:01:59.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*M3PBst5TjIbOgnF2.jpg" /><figcaption>( Source: XDA-Developers )</figcaption></figure><blockquote><strong>What is rooting and custom ROM</strong></blockquote><p>Rooting is the means of unlocking the android operating system on your phone for full customisation. With root access, you can change system-level applications and settings to perform operations with privileged permissions that are impossible for an average user. And by use of some apps, you can access even push the device to its total potential capacity.</p><p>Now what&#39;s&#39;s custom ROM, its essentially a third-party operating system that replaces the manufacturers-installed (aka stock ROM) operating system from your phone. For example, if you have a Samsung phone with OneUI running, you can install an ASOP rom to have stock like look on your Samsung device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*fPKTUjipEVOCHCGzquFaOQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*1o_xibwvD32D-iZSdv-EGg.jpeg" /><figcaption>Havoc OS — Android 12</figcaption></figure><p><strong><em>Disclaimer: </em></strong><em>Unlocking the bootloader/ installing custom rom will wipe all the data on your smartphone and in some cases, may even void your warranty. It&#39;s’s also important to understand that not following the steps correctly may result in a bricked phone so make sure you know how to recover your phone back to its original state in case you end up in a situation like that. Furthermore, Magisk may cause issues with a few banking and payment-related apps so if those are absolutely vital to you, proceed with caution.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*f1GtElkLaJzBjLWY.png" /></figure><blockquote><strong>Why to root</strong></blockquote><h4>1. Performance improvement</h4><p>You can uninstall the bloatware that&#39;s making your device slow. Bloatwares are unwanted apps that come preinstalled on a phone. For example, many samsung phones come up with Facebook and Linkedin app preinstalled. It takes up space, reduces battery life, and cripples performance. You can get rid of bloatware on a rooted phone.</p><p>For more advanced users, installing custom kernels, overclocking (or underclocking) the processor gives the full potential of using a android phone. Overclock improves the performance of phone but battery usage is more. While underclock conserves the battery life of your phone.</p><h4>2. Custom roms</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*00BGOGAj-ZSz4JJp.jpg" /></figure><p>By installing a custom ROM (my favourite ;), you can give your device a fresh new look. Lineage OS, Pixel Experience, Havoc OS, Arrow OS, dotOS, are the most famous among the android enthusiasts community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*-8R7ZAR17O83ZNog.jpg" /></figure><h4>3. Secure and Quick updates</h4><p>Apple devices get system updates within a day or two as it is released. Unfortunately, most android companies deliver the system updates very late if they deliver at all. But you can quickly and securely update your phone using the custom rom. Many custom rom developer even provides OTA updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*MRCaYNg3xHqbCP55.jpeg" /></figure><h4>4. Custom Mods</h4><p><a href="https://forum.xda-developers.com/t/app-root-nonroot-official-adaway-v5-11-0.2190753/"><em>AdAway</em></a> can be used on rooted phone for ad blocking system wide. For theming there is <em>substratum theme engine</em> to give a new overhaul to your device. Magisk and Xposed modules for tweaks and customisation of every inch of your android device.</p><blockquote><strong>How to root</strong></blockquote><p><strong>1. Unlock bootloader</strong><br>First thing first, for rooting or installing any custom ROM/recovery, you need to unlock the bootloader of your android phone. Unfortunately, different phone manufacturers employ different methods for unlocking different. Just google “xda unlock bootloader &lt;insert full model name&quot;&gt;”. There would be a good article for unlocking the bootloader. <br>For Samsung - <a href="https://forum.xda-developers.com/t/android-unsamlock-bootloader-unlock-for-samsung-us-canada-devices.4215101/"><em>click here</em></a><em> <br></em>For OnePlus - <a href="https://www.xda-developers.com/unlock-bootloader-root-oneplus-7-pro/"><em>click here</em></a><br>For Xiaomi - <a href="https://forum.xda-developers.com/t/guide-unlock-bootloader-and-flash-xiaomi-eu-rom.3952443/"><em>click here</em></a><br>For your phone - <a href="https://www.google.com/"><em>click here</em></a></p><p><strong>2. Install custom recovery</strong><br>Before installing custom rom, you need to replace stock recovery with custom recovery like TWRP or <a href="https://orangefox.download/"><em>Orange Fox Recovery.</em></a> This is because stock recovery won&#39;t allow instalation of other firmwares. <br>Go to<em> </em><a href="https://twrp.me/"><em>TWRP website</em></a> or xda thread of your device to get the latest custom recovery image. Before proceeding future make sure to get <a href="https://forum.xda-developers.com/t/official-tool-windows-adb-fastboot-and-drivers-15-seconds-adb-installer-v1-4-3.2588979/"><em>adb and fastboot</em></a> installed.<br>Next step is to <a href="https://www.xda-developers.com/how-to-install-twrp/"><em>flash the custom recovery</em></a><em>. </em>Boot the device into bootloader mode and execute the command to flash the recovery image to device. Voila then reboot to device to have your recovery installed.</p><pre>$ adb reboot bootloader<br>$ fastboot flash recovery twrp.img<br>$ fastboot reboot recovery</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zp7G5lnysQZb9Nud.jpg" /></figure><p><strong>3. Install Custom Rom</strong></p><p>Now comes the fun part, time to install your favourite custom rom to your device. There are lots of beautiful roms to choose from that will give your device a fresh and brand new look.</p><p>If you want a simple and elegant rom then go Lineage OS, for heavy customisation go for havoc os (formally known as resurrection remix), or pixel-like experience then go for Pixel Experience. There are other to choose from, like Arrow OS, Dot OS to satisfy the taste of anyone.</p><p><strong>4.</strong> <strong>Install Magisk</strong></p><p>In the next step, we are going to install magisk from custom recovery which you just installed.</p><ul><li>Download the <a href="https://github.com/topjohnwu/Magisk/releases/download/v23.0/Magisk-v23.0.apk"><em>Magisk APK</em></a>.</li><li>Rename the .APK file extension to .ZIP (e.g. Magisk-v23.0.APK → Magisk-v23.0.ZIP).</li><li>Reboot to recovery. (Google &quot; “reboot to recovery &lt;your phone mode&quot;&gt;” to know how)</li><li>Tap <em>install</em> and select the magisk zip file. After installation, reboot to system.</li><li>Check whether the Magisk app is installed. If its isn&#39;t installed automatically, manually install the APK.</li><li>Voila, You have successfully rooted your phone. Time to enjoy ;)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/0*-FbphirwaXc8aCbD.jpg" /></figure><p>Source: <a href="https://www.xda-developers.com/">https://www.xda-developers.com/</a></p><p><em>PS: Check out xda site for any custom rom or root related guide. It&#39;s the BEST website for modding android phones.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56aff6094388" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/rooting-custom-roms-part-1-56aff6094388">Rooting &amp; Custom Roms— Part 1</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Support Vector Machines — An Introduction]]></title>
            <link>https://medium.com/delta-force/support-vector-machines-an-introduction-3adf25ecbab4?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/3adf25ecbab4</guid>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Karthik Sundar]]></dc:creator>
            <pubDate>Mon, 24 Jan 2022 14:20:35 GMT</pubDate>
            <atom:updated>2022-01-24T14:20:35.189Z</atom:updated>
            <content:encoded><![CDATA[<h3>Support Vector Machines — An Introduction</h3><p>Support Vector Machines abbreviated as SVM is a machine learning algorithm used in both regression and classification tasks. However, it is widely preferred to use in Classification Tasks. Before getting into SVM, let us look into Maximal Margin Classifiers and Support Vector Classifiers.</p><h3><strong>Maximal Margin Classifiers</strong></h3><p>Let’s take the below-shown training dataset. Our task is to classify the green dots from the red dots. In this case, the Maximal Margin Classifier draws a line that is the furthest away from both the closest green and red dots. In ML lingo, this line is usually called a hyperplane. A hyperplane is a subspace whose dimension is one less than the parent dimension. Here the points are in 2 dimensions, so the hyperplane tends to be a 1-dimensional line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*Iy6Ilhua-PJAwcMw.png" /></figure><p>This seems like a solution that may work for all cases, but that’s where we are wrong. Let’s take the case where we have an exceptional green dot much closer to the red dot cluster and far away from other green dots. In this case, Maximal Margin Classifier will give us a hyperplane that will be much closer to the red cluster than the green cluster. When asked to predict, our model will most of the time predict it is a green dot. Thus our model will perform poorly in test data, even though it performs well in training data-set. In ML-Lingo, our model is told to have high bias and low variance. To solve this issue, we have <strong>support vector classifiers</strong>.</p><h3><strong>Support Vector Classifiers</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/0*fTSZoZUMC8y9w191.jpg" /></figure><p>So, instead of taking the two closest points from each cluster, we take any two points, one from each cluster. Thus we allow for some misclassification, but our model will perform well in most of the cases. To decide which two points to consider, we use cross-validation.</p><p>Support Vector Classifiers are very similar to Support Vector Machines. In the case of Linear Data Sets (i.e Data Sets that can be separated by a linear line), Support Vector Machines work exactly like told above. However, Support Vector Machines really shine when we have a Non-Linear Data Set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*_Si1zLqiVTcpJ1GP.png" /></figure><h3><strong>Support Vector Machines for Non-Linear Data Sets</strong></h3><p>To classify non-linear data, SVM uses the <strong>kernel</strong> trick. Basically, it transforms the data to a higher dimension and then finds the hyperplane which will classify the transformed data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/0*rcYKHb_RkBzcj7Wj.png" /></figure><p>There are several kernels out there, but for now, let’s take a good look at the polynomial kernel.</p><p>Note: These kernel functions calculate the higher-order relationships as if the data is transformed into a higher dimension. They don’t actually transform the data, thus these kernel functions are efficient.</p><h4><strong>Polynomial kernel</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*MFaQlABKI1nHJsmRMHfxLQ.png" /><figcaption>Polynomial Kernel Function</figcaption></figure><p>So Let’s take the case of r = 1/2 and d = 2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*9TI6ybV9NQ_gDjTnIRtJow.png" /></figure><p>So as you can see we get a dot product in two dimensions( We can ignore the z-value as it’s the same for both the points). This dot product is enough to calculate higher-order relationships. The math required to understand why only the dot product is enough can’t be explained in a single medium post :(</p><p>As d increases, the model may start to overfit. Overfit is the case when our model only performs well in our training data set. It is the case of high bias and low variance.</p><h4><strong>Radial Kernel</strong></h4><p>The function for the radial kernel is as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*YW_n-ll5vATb_IcvvwzuZg.png" /></figure><p>Radial kernel aka Radial Basis Function calculates the relationship between a pair of points as if they are in <em>infinite dimensions. </em>To understand how it achieves this, we will have another look at the polynomial kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*OxCqpGZMNM-K_VfA8Cj7bw.png" /></figure><p>We set r = 0 in the polynomial kernel. As shown above, when we add the result for d = 1 and d = 2, we get the dot product for two dimensions. Let’s say we don’t stop at d = 2 and continue till infinity. Then we will get the <em>dot product in infinite dimensions</em>. So how does this relate to radial basis function?</p><p>Let’s take the gamma value of 1/2 and expand the radial basis function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*t_byIopJ2x3Z-9SsoHjTsw.png" /></figure><p>Now we use <strong>Taylor Expansion</strong> to expand the last term</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*pXhObELd2yRL7evUqGXkyg.png" /></figure><p>When we try to get the dot product from this, we get</p><p>Thus we can see that the radial kernel calculates the relationships as if they were transformed into infinite dimensions.</p><p>As gamma increases, the model tends to overfit. On the other hand, if gamma is too low, the model tends to underfit. Generally, we use cross-validation to find a proper value for gamma.</p><h4><strong>Advantages of SVM:</strong></h4><ul><li>As it uses only some points from the training data set as support vectors, it is memory efficient.</li><li>Work well in high-dimensional Spaces</li></ul><h4><strong>Disadvantages of SVM:</strong></h4><ul><li>Doesn’t work well when we have a lot of noise in our training dataset.</li><li>Requires a lot of time to train if we have large training data sets.</li></ul><h3><strong>Code</strong></h3><p>First, we import the necessary libraries</p><pre>import matplotlib.pyplot as plt<br>import numpy as np<br>from sklearn import datasets<br>from sklearn import svm</pre><p>Then we make our sample dataset. Here we make a non-linear data-set</p><pre>X, y = datasets.make_circles(n_samples=300, noise=0.1)<br>plt.scatter(X[:, 0], X[:, 1], c=y, marker=&quot;.&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*NO3egIgq2GyZ2K7aOLqptw.png" /></figure><p>Then we instantiate our SVM and fit our data to it. First, we will use the polynomial kernel,</p><pre>clf = svm.SVC(kernel=&#39;poly&#39;, C=1.0)<br>clf.fit(X, y)</pre><p>Now we will write some code to plot the decision boundary</p><pre>def plot_decision_boundary(model, ax=None):<br>    if ax is None:<br>        ax = plt.gca()<br>        <br>    xlim = ax.get_xlim()<br>    ylim = ax.get_ylim()<br>    <br>    x = np.linspace(xlim[0], xlim[1], 30)<br>    y = np.linspace(ylim[0], ylim[1], 30)<br>    Y, X = np.meshgrid(y, x)</pre><pre><br>    xy = np.vstack([X.ravel(), Y.ravel()]).T<br> <br>    P = model.decision_function(xy).reshape(X.shape)<br>    <br>    # plot decision boundary<br>    ax.contour(X, Y, P,<br>               levels=[0], alpha=0.5,<br>               linestyles=[&#39;-&#39;])</pre><p>Now we will plot the result,</p><pre>plt.scatter(circle_X[:, 0], circle_X[:, 1], c=circle_y, s=50)<br>plot_decision_boundary(nonlinear_clf)<br>plt.scatter(nonlinear_clf.support_vectors_[:, 0], nonlinear_clf.support_vectors_[:, 1], s=50, lw=1, facecolors=&#39;none&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*ZFyyx9dGcyMylf9v1aPptA.png" /></figure><p>As you can see the polynomial kernel didn’t do much of a good job. Usually, we use something called a radial kernel or radial basis function. It calculates the relationships between two data points as if they have <em>infinite dimensions</em>.</p><p>When we use the radial basis function,</p><pre>clf = svm.SVC(kernel=&#39;rbf&#39;, C=1.0)<br>clf.fit(X,y)</pre><p>We get the following result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*HYZr4nug5h13LqeBSOy-kQ.png" /></figure><p>As you can see, it did a much better job!</p><p>Thus, we have reached the end of this post. Thanks for reading!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3adf25ecbab4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/support-vector-machines-an-introduction-3adf25ecbab4">Support Vector Machines — An Introduction</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[STL Sundays Part 2 (C++ STL Containers Continued)]]></title>
            <link>https://medium.com/delta-force/stl-sundays-part-2-c-stl-containers-continued-2e89bf2d18dc?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/2e89bf2d18dc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[stl]]></category>
            <category><![CDATA[c]]></category>
            <dc:creator><![CDATA[S Hariesh]]></dc:creator>
            <pubDate>Sun, 28 Nov 2021 13:37:18 GMT</pubDate>
            <atom:updated>2021-11-28T13:37:18.564Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Hey everyone!! In this week’s article, we shall continue to explore some more C++ STL containers that are as follows:</p><ul><li>Priority queue</li><li>Map</li><li>Set</li><li>Unordered map</li><li>Unordered set</li></ul><p>Under each of the above STL container, I shall give an insight about the data structure itself initially and then list down its methods, explaining them all briefly so that all of the basics are covered. I have also mentioned the time complexities of all the methods so that you will be aware of how your code will respond to enlarging data. Now that the intro is complete, we shall start with priority queues.</p><h3>std::priority_queue</h3><p>Let’s just get one thing straight from the very beginning — priority queues are very different from normal queues. Yes, you can retrieve only one element at a time like in normal queues, but priority queues store data in a specific order and do not follow the FIFO rule as normal queues do. By default they store numbers in descending order and strings are stored in descending order of their corresponding ASCII value (compared letter by letter). Nevertheless, we can also store numbers in ascending order and strings in lexicographical order if we use priority_queue&lt;int, vector&lt;int&gt;, greater&lt;int&gt;&gt; and priority _queue&lt;string, vector&lt;string&gt;, greater&lt;string&gt;&gt; while declaring the priority queues respectively. All these features make priority queue a perfect candidate for problems that require repeated optimization like in Dijkstra’s algorithm, etc.</p><h3>Commonly used methods</h3><h4>Access methods</h4><p><em>top()</em> — It’s used to get the most prior element from the priority queue. In case you created a default priority queue, it will return the element with largest value and in case it was changed to ascending/lexicographical order while declaration, it would return the element with lowest value. If the priority queue is empty, this method exhibits undefined behavior. Time complexity of this method is O(1).</p><h4>Capacity related methods</h4><p><em>empty() </em>— It’s used to check if a priority queue has no elements or not. It returns 1 (true value) if the priority queue is empty, else it returns 0 (false value). Time complexity of this method is O(1).</p><p><em>size() </em>— It’s used to find how many elements are present in the priority queue. It returns X if there are X elements in the priority where X is a whole number. Time complexity of this method is O(1).</p><h4>Modify methods</h4><p><em>push(input)</em> — It’s used to add elements into the priority queue. It takes 1 argument — the element to be added, and that specified element will be added to the priority queue based on priority. Time complexity of this method is O(logn).</p><p><em>pop()</em> — It’s used remove the most prior element from the priority queue but it doesn’t return anything. If the priority queue was empty, this method results in undefined behavior. Time complexity of this method is O(logn).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4963ae8e9f4222801121c5e56dd06f13/href">https://medium.com/media/4963ae8e9f4222801121c5e56dd06f13/href</a></iframe><h3>std::map</h3><p>If you want to store data as pairs that are linked together, maps are a perfect choice. Maps store data in the form of key-value pairs. Given the ‘key’, you will be able to find it’s ‘value’ because the ‘key’ and the ‘value’ are linked together. It’s highly important to note that the keys must be unique and must connect to one and only one value. However, two different keys can map to the same value. They are pretty much like functions that we learnt in our math classes. One more point about normal maps is that their keys are in sorted order (ascending/lexicographical by default which could be altered just like we discussed in priority queues).</p><h3>Commonly used methods</h3><h4>Access methods</h4><p><em>at(key)</em> — It gives the value associated with the given ‘key’ input. However, if the given input ‘key’ doesn’t exists it throws an “out of range error”. Time complexity of this method is O(logn).</p><p><em>name_of_map[key] </em>— The square bracket operator can be used just like in case of arrays. The ‘value’ of the ‘key’ put inside the square brackets will given. This operator can also be used for inserting elements by assigning the new key with its value like this name_of_map[new_key] = value Time complexity of this operation is O(logn).</p><h4>Capacity related methods</h4><p><em>empty() </em>— It returns 1 if the map is empty (has no elements) or returns 0 if the map isn’t empty. Time complexity of this method is O(1).</p><p><em>size() </em>— It returns the number of key-value pairs in the map. Time complexity of this method is O(1).</p><h4>Modify methods</h4><p><em>insert()</em> — It’s used to add key-value pairs to the map. There are two ways to use it:</p><ul><li>name_of_map.insert({key, value})</li><li>name_of_map.insert(std::make_pair(key, value))</li></ul><p>Worst case time complexity of this method is O(logn).</p><p><em>erase(key) / erase(iterator) / erase(iterator1, iterator2)</em> — As you may have noticed, there are 3 ways to use the erase method. erase(key) removes the key-value pair of the input ‘key’. erase(iterator) removes the key-value pair pointed by the iterator given as input. erase(iterator1, iterator2) is used to remove a range of key-value pairs by giving two iterators as its input — the starting iterator(included) and the ending iterator(excluded). Worst case time complexity of this method is O(logn).</p><p><em>clear()</em> — It is used to delete all key-value pairs from the map. Time complexity of this method is O(n).</p><h4>Search methods</h4><p><em>find(key)</em> — It takes a ’key’ as its input. If the ‘key’ exists, it returns an iterator to that ‘key’ in the map. If the ‘key’ doesn’t exists it returns a constant iterator which refers to end() iterator. Time complexity of this method is O(logn).</p><p><em>count(key)</em> — It takes a ‘key’ as its input and returns 1 if the ‘key’ exists in the map, else it returns 0. Time complexity of this method is O(logn).</p><p><em>lower_bound(key) </em>— This method returns an iterator pointing to the key (input) in the map container. In case the key isn’t present in the map, the function returns an iterator pointing to the immediate next element which is just greater than key. If the key passed in the parameter exceeds the maximum key in the container, then the returned iterator points to the number of elements in the map as key and element could be any element. The time complexity of this method is O(logn).</p><p><em>upper_bound(key) </em>— The function returns an iterator pointing to the immediate next element which is just greater than key (input). If the key passed in the parameter exceeds the maximum key in the container, then returned iterator refers to <em>name_of_map.end(). </em>The time complexity of this method is O(logn).</p><h4>Largest and smallest key</h4><p>Incase you want to find the smallest key in the map, there is a witty way to do so. You can use name_of_map.begin() which will return an iterator to the first key of the map but by default elements are arranged in ascending order in maps, hence the first key is also the smallest key. Similarly if you want to find the largest key, you can use name_of_map.rbegin() which will return an iterator referring to the last key of the map. You can increment these iterators to obtain subsequent smaller/larger keys as well. The time complexity of incrementing these iterators is O(logn).</p><h4>Key and value from iterator</h4><p>Suppose you have an iterator pointing to a key in your map, and you want to know the key and its associated value, you can use name_of_iterator-&gt;first to obtain the key and name_of_iterator-&gt;second to obtain the value. You can also use *(name_of_iterator).first and *(name_of_iterator).second to obtain the key and value respectively.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe1c14bd82a838853e4f87da3f8ffcc5/href">https://medium.com/media/fe1c14bd82a838853e4f87da3f8ffcc5/href</a></iframe><h3>std::set</h3><p>You can think of sets as just storing a collection of data which must be unique (not repeated). Hence you can think of sets as maps with just the ‘key’ part. Also similar to maps, the numbers stored in sets are automatically arranged in ascending order, and string are arranged in lexicographical order.</p><h3>Common methods</h3><h4>Access methods</h4><p>There are no explicit access methods for sets. However, you can use <em>find() </em>method to get an iterator to refer to an element (if it exists).</p><p><em>find(parameter)</em> — If you want to access an element, you can use this method which returns an iterator to the element passed in as the parameter. If the element doesn’t exist, it returns <em>end()</em> iterator. Time complexity of this method is O(logn).</p><h4>Capacity related methods</h4><p><em>size()</em> — It’s used to get the number of elements in the set. Time complexity of this method is O(1).</p><p><em>empty()</em> — This method returns 1 if the set has no elements else it returns 0. Time complexity of this method is O(1).</p><h4>Modify methods</h4><p><em>insert(parameter)</em> — This method is used to add elements to the sets. The element to be added needs to be passed as the parameter. Worst case time complexity of this method is O(logn).</p><p><em>erase(parameter)</em> — It’s used for erasing an element from the set. The element to be deleted needs to be passed as the parameter. In case the element you passed in was not present in the set it doesn’t throw any error. Worst case time complexity of this method is O(logn).</p><p><em>clear()</em> — It deletes all the elements stored in the set. Time complexity of this method is O(n).</p><h4>Search Methods</h4><p><em>count(parameter)</em> — helps you to get the count of an element in the set. Since elements are unique in sets, it can be used to check if an element exists or not in the set. Time complexity of this method is O(logn).</p><p><em>find(parameter)</em> — if you want to access an element, you can use this method which returns an iterator to the element passed in as the parameter. If the element doesn’t exist, it returns end() iterator. Time complexity of this method is O(logn).</p><p><em>lower_bound(entry) </em>— This method returns an iterator pointing to the entry (input) in the map container. In case the entry isn’t present in the map, the function returns an iterator pointing to the immediate next element which is just greater than entry. If the entry passed in the parameter exceeds the maximum value in the container, then the iterator returned refers to <em>name_of_set.end(). </em>The time complexity of this method is O(logn).</p><p><em>upper_bound(entry) </em>— The function returns an iterator pointing to the immediate next element which is just greater than entry (input). If the entry passed in the parameter exceeds the maximum entry in the container, then returned iterator refers to <em>name_of_set.end(). </em>The time complexity of this method is O(logn).</p><h4>Largest and smallest entry</h4><p>Just like in maps, in sets too you can find the smallest entry and largest entry using name_of_set.begin() and name_of_set.rbegin() respectively. You can increment these iterators to obtain subsequent smaller/larger entries. The time complexity of incrementing remains O(logn) for sets too.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27f0516e5357898a1d2dc04df3bd9318/href">https://medium.com/media/27f0516e5357898a1d2dc04df3bd9318/href</a></iframe><h3>std::unordered_map</h3><p>An unordered map differs from an ordered map in 4 main areas:</p><ol><li><strong>Inbuilt implementation:</strong> An unordered map, under the hood, is built based on hash maps whereas ordered maps are built based on red-black trees (self balancing binary trees). This fundamental difference gives rise to all the differences that exist between an unordered and an ordered map. For now, it’s not necessary to dwell deep into what hash maps or red-black trees are. Just focus on the differences and how you can benefit from it.</li><li><strong>Order in which data is stored:</strong> This difference is name deductive. Unordered maps have no order when it comes to storing data while ordered maps have a sorted order.</li><li><strong>Time complexity of certain operations:</strong> As you will see soon in the methods, unordered maps are faster compared to ordered maps. Time complexity of certain operations of ordered maps is improved compared to unordered maps.</li><li><strong>Limitation on data types of the key:</strong> Any data structure whose hash value can’t be found can’t be used as keys in unordered maps. To put it in simple words, primitive data types like <em>int, char, strings </em>are all fine but complex ones like <em>vectors, pairs</em> are a no no. However, no such problem is faced with ordered maps because they are based on trees (where comparison of the data is enough). This limitation can still be solved if we make the data type hashable by writing your own <em>std::hash&lt;&gt;</em> for the class. <a href="https://www.geeksforgeeks.org/stdhash-class-in-c-stl/"><em>More info here</em></a></li></ol><h3>Commonly used methods</h3><p>Methods are of unordered are the same as the ones under ordered maps but their time complexities differ.</p><h4>Access methods</h4><p><em>at(key)</em> — It gives the value associated with the given key input. However, if the given input key doesn’t exists it throws an “out of range error”. Average time complexity is O(1) while worst case time complexity is O(n).</p><blockquote>Now you may ask — “How come a worst case complexity of O(n) be better than a consistent O(logn) time complexity as in ordered maps?”. The answer relies on hashing because the worst case scenario occurs when the hashing produces collisions, i.e. more than one ‘key’ starts giving the same ‘value’ after hashing. But this is a rare case and hence most of the time this method operates at O(1). You will need to keep a note of this because all the access, insertion, deletion and search methods here and in unordered sets have the same justification for their time complexity.</blockquote><p><em>name_of_map[key]</em> — This square bracket operator can be used just like in case of arrays. The value of the key put inside the square brackets will given. This operator can also be used for inserting elements by assigning the new key with its value like this name_of_map[new_key] = value Average time complexity is O(1) while worst case time complexity is O(n).</p><h4>Capacity related methods</h4><p><em>empty() </em>— It returns 1 if the map is empty (has no elements) or returns 0 if the map isn’t empty. Time complexity of this method is O(1).</p><p><em>size()</em> — It returns the number of key-value pairs in the map. Time complexity of this method is O(1).</p><h4>Modify methods</h4><p>insert() — It’s used to add key-value pairs to the map. There are two ways to use it:</p><ul><li>name_of_map.insert({key, value})</li><li>name_of_map.insert(std::make_pair(key, value))</li></ul><p>Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>erase(key) / erase(iterator) / erase(iterator1, iterator2)</em> — As you may have noticed, there are 3 ways to use the erase method. erase(key) removes the key-value pair of the input key. erase(iterator) removes the key-value pair pointed by the iterator given as input. erase(iterator1, iterator2) is used to remove a range of key-value pairs by giving two iterators as its input — the starting iterator(included) and the ending iterator(excluded). Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>clear() </em>— It is used to delete all key-value pairs from the map. Time complexity of this method is O(n).</p><h4>Search Methods</h4><p><em>find(key) </em>— It takes a ‘key’ as its input. If the ‘key’ exists, it returns an iterator to that ‘key’ in the map. If the ‘key’ doesn’t exists it returns a constant iterator which refers to <em>end() </em>iterator. Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>count(key</em>) — It takes a ‘key’ as its input and returns 1 if the ’key’ exists in the map, else it returns 0. Average time complexity is O(1) while worst case time complexity is O(n).</p><h4>Key and value from iterator</h4><p>Suppose you have an iterator pointing to a key in your unordered map, and you want to know the key and its associated value, you can use name_of_iterator-&gt;first to obtain the key and name_of_iterator-&gt;second to obtain the value. You can also use *(name_of_iterator).first and *(name_of_iterator).second to obtain the key and value respectively.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83b3de3e107e0389b0ef9564b88d7f36/href">https://medium.com/media/83b3de3e107e0389b0ef9564b88d7f36/href</a></iframe><h3>std::unordered_set</h3><p>Just like how sets are similar to map with just keys, unordered sets are similar to unordered maps with just keys. The elements stored in unordered set are not stored in any specific order. The time complexities of some operations are improved over normal sets.</p><h3>Common Methods</h3><h4>Access methods</h4><p>There are no explicit access methods. However, you can use <em>find()</em> method to get an iterator to refer to an element (if it exists).</p><p><em>find(parameter)</em> — if you want to access an element, you can use this method which returns an iterator to the element passed in as the parameter. If the element doesn’t exist, it returns <em>end()</em> iterator. Average time complexity is O(1) while worst case time complexity is O(n).</p><h4>Capacity related methods</h4><p><em>size()</em> — used to get the number of elements in the set. Time complexity of this method is O(1).</p><p><em>empty()</em> — returns 1 if the set has no elements else it returns 0. Time complexity of this method is O(1).</p><h4>Modify methods</h4><p><em>insert(parameter)</em> — This method is used to add elements to the sets. The element to be added needs to be passed as the parameter. Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>erase(parameter) </em>— It’s used for erasing an element from the set. The element to be deleted needs to be passed as the parameter. In case the element you passed in was not present in the set it doesn’t throw any error. Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>clear()</em> — It deletes all the elements stored in the set. Time complexity of the method is O(n).</p><h4>Search methods</h4><p><em>count(parameter) </em>— helps you to get the count of an element in the set. Since elements are unique in sets, it can be used to check if an element exists or not in the set. Average time complexity is O(1) while worst case time complexity is O(n).</p><p><em>find(parameter)</em> — if you want to access an element, you can use this method which returns an iterator to the element passed in as the parameter. If the element doesn’t exist, it returns end() iterator. Average time complexity is O(1) while worst case time complexity is O(n).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c996db448bd506adeec54ad7a4f51a5/href">https://medium.com/media/9c996db448bd506adeec54ad7a4f51a5/href</a></iframe><h3>Conclusion</h3><p>I tried my best to cover all the basics of this week’s C++ STL containers. I hope you got something useful out from this article and enjoyed it as much. I again emphasize that these are just the basics and you will learn more as you you code and face problems while using these containers. To know more about these containers and other containers in STL , you can visit <a href="https://en.cppreference.com/w/cpp/container"><em>cppreference.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e89bf2d18dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/stl-sundays-part-2-c-stl-containers-continued-2e89bf2d18dc">STL Sundays Part 2 (C++ STL Containers Continued)</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to React]]></title>
            <link>https://medium.com/delta-force/introduction-to-react-8c58de2af2b1?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/8c58de2af2b1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Suhail Ahmed]]></dc:creator>
            <pubDate>Fri, 26 Nov 2021 11:57:37 GMT</pubDate>
            <atom:updated>2021-11-26T11:57:37.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7LkR8NjNuH71V1Ci00ttSA.jpeg" /></figure><h3>Introduction to React ⚛️</h3><p><strong>Say hello to the world of React.js</strong></p><p><em>Before we begin, I would like to bring it to your attention that this article requires prior knowledge related to basic JavaScript and Web Development Paradigms such as DOM.</em></p><h3>What is React.js?</h3><p>React… let’s say you are browsing the internet and the content on a page requires some changes according to your inputs, time, or any other factor.. JavaScript seems to be inefficient and complex for handling those changes, hence a library to “react” to those factors and update the content of a page is called React.js ⚛️.</p><p>React is component based, meaning it can be used to build simple reusable components of the UI (example: a button) and use it everywhere in your app.</p><p>React is state based, implying the app’s state is handled and accordingly the render takes place, this helps to write better and predictable code.</p><p>To phrase it properly, React is a free and open-source front-end JavaScript library for building user interfaces or UI components.</p><h3>History (A small flashback) 📜</h3><p>In 2013, Facebook struggled while handling Facebook Ads and was looking for a way to make small components that build up to make bigger and multifunctional apps. Hence, some basic prototype versions of react were made such as Xhp, and FaxJS. Soon after acquiring Instagram, Facebook built the first stable version of React and deployed it in 2014 as a small part of its User Interface while also open-sourcing it. Many had hopes but were skeptical with thoughts that were along the lines of “HTML in JavaScript? Why?”</p><h3>Why?</h3><p>I am going to use a bunch of codepens to explain and address the issue React solves.</p><p>Codepen made with DOM (Document Object Manipulation):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuhailahmed2627%2Fembed%2Fpreview%2FmdMVXEw%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DmdMVXEw&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsuhailahmed2627%2Fpen%2FmdMVXEw&amp;image=https%3A%2F%2Fassets.codepen.io%2F7086160%2Finternal%2Fscreenshots%2Fpens%2FmdMVXEw.default.png%3Ffit%3Dcover%26amp%3Bformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D2%26amp%3Bversion%3D1634388475%26amp%3Bwidth%3D640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/56493027f6e697586f3c2c41a9d4a565/href">https://medium.com/media/56493027f6e697586f3c2c41a9d4a565/href</a></iframe><p>Codepen made with React:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuhailahmed2627%2Fembed%2Fpreview%2FWNErMry%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DWNErMry&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsuhailahmed2627%2Fpen%2FWNErMry&amp;image=https%3A%2F%2Fassets.codepen.io%2F7086160%2Finternal%2Fscreenshots%2Fpens%2FWNErMry.default.png%3Ffit%3Dcover%26amp%3Bformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D2%26amp%3Bversion%3D1634388464%26amp%3Bwidth%3D640&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ebd336acabee84f147d8b9ff2f4f7f3/href">https://medium.com/media/2ebd336acabee84f147d8b9ff2f4f7f3/href</a></iframe><p>The difference might not seem obvious in these pages and that is okay. Let’s have a look on these lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19c9c8f46f3b7939bca948c2f3faadb7/href">https://medium.com/media/19c9c8f46f3b7939bca948c2f3faadb7/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96de37e514dc909b9b6984b9993fd29e/href">https://medium.com/media/96de37e514dc909b9b6984b9993fd29e/href</a></iframe><p>The two snippets above do almost the exact same thing. But which among these do you think resemble the HTML more? Which one do you think feels simpler? To be honest, this example doesn’t really show the scale of simplifying, that React or jsx (writing HTML in JS) does to the manipulation of HTML. Moreover, while programming, using the JavaScript (DOM), the program becomes heavily complicated, and tracking down bugs could be extremely hard. If your solution is to simplify and just use the DOM strategy then let me tell you that this is what React does :) but in an extremely complex way to enhance performance and neatness of the code.</p><p>Other frontend frameworks accomplish this as well but they all have different trade-offs. We will focus mainly on react in this Article. Reasons to choose react would be:</p><ol><li>Light weight — comes at around 41kBs (minified + gzipped).</li><li>Large Community — <a href="https://github.com/enaqx/awesome-react">Everything</a> you need. You will find it.</li><li>Most Popular framework in recent times.</li></ol><h3>How to code the “hello world” react App?</h3><p>Once you have <a href="http://nodejs.org/">Node.js</a> and <a href="http://npmjs.org/">NPM</a> installed go ahead and run the following command in your terminal:</p><pre>npx create-react-app my-app // Sets up a basic react project</pre><p>Open the folder “my-app” in any of your code editor. This is how the files should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*ne3xKN4vTyO8sglmFvGs9w.png" /></figure><p><strong>src —</strong>Folder where the main core react files will be coded and stored.</p><p><strong>public —</strong>Folder where you can place your assets and the index.html file.</p><p>Please feel free to ignore the following files as we won’t be testing our app or report vitals for time being :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*hr7PV9iESCSRASsQih2--Q.png" /></figure><p>In every react based project, there will be an index.html containing a div or a section tag with an id of “root”. This div is where we would render or paint our complete react app.</p><p>Open the src/index.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBL2B2JM6QgtlHD3lf2fTA.jpeg" /><figcaption>The Purpose of Index.js</figcaption></figure><p>But what is App? App is just a function. A JavaScript Function. Yes, React has brought a component based UI system to its bare minimum. I may sound weird, but trust me, it took decades to get here. and React is the finest in history. At least according to most of the web developers.</p><p>src/App.js resembles our complete app and whatever is inside it, is all that there is. Almost every React component is of the following type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FqJ5GdIRfOC2bOEcBZ-cbQ.jpeg" /><figcaption>Structure of App.js or any React Component</figcaption></figure><p>Now to view the App, open the terminal in the my-app folder and run:</p><pre>npm run start<br>// Starts the react app</pre><p>You should see something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*aNU6EYE3ykoxJIcvFMV0kQ.png" /></figure><p>Open the link and you should see:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FraeJHEPAnvUBZ0bV1T%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FraeJHEPAnvUBZ0bV1T%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FraeJHEPAnvUBZ0bV1T%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="233" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fee7e22b1b229d3fddb4f612319c56e/href">https://medium.com/media/6fee7e22b1b229d3fddb4f612319c56e/href</a></iframe><p>And that’s how you just said Hello to the world of React.js !🎉</p><p>Click Learn React and go through react docs and tutorials, if you are interested. I will see you again in “useState and useEffect: Introduction to React Hooks” :)</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c58de2af2b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/introduction-to-react-8c58de2af2b1">Introduction to React</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[STL Sundays, Introduction to STL Containers (Part 1)]]></title>
            <link>https://medium.com/delta-force/stl-sundays-introduction-to-stl-containers-part-1-6ef56a82dd41?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/6ef56a82dd41</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[stl]]></category>
            <category><![CDATA[cpp]]></category>
            <dc:creator><![CDATA[Dipesh Kafle]]></dc:creator>
            <pubDate>Sun, 14 Nov 2021 12:29:41 GMT</pubDate>
            <atom:updated>2021-11-14T12:29:40.887Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The <strong>Standard Template Library</strong> (<strong>STL</strong>) is a software library for the <a href="https://en.wikipedia.org/wiki/C%2B%2B">C++</a> programming language that influenced many parts of the C++ Standard Library . It provides four components called</p><ul><li>algorithms</li><li>container</li><li>iterators</li><li>functions</li></ul><p>In the first week of STL Sundays, we will be covering some basic containers( data structures) . Being specific, we will cover</p><ul><li>std::vector</li><li>std::stack</li><li>std::queue</li><li>std::deque</li><li>std::list</li></ul><p>Before diving straight into the containers however, we must have knowledge about <em>iterators</em>.</p><p><strong>Iterators: Building block of C++ Standard Library</strong></p><p>Iterators are an integral part of STL. Pretty much all STL algorithms are designed to work with iterators and you will see them being used extensively in our series as well. Almost every container in C++ standard library have iterators. Iterators are mostly used to specify the range on which an algorithm or operation should be performed on. Only std::stack, std::queue and std::priority_queue(which are naturally not supposed to be iterated on) are the containers that lack iterators.</p><p><strong>General working with iterators</strong></p><ul><li><strong>begin()</strong> : This will return the beginning iterator of the container. This can be invoked in two ways: std::begin(container) or container.begin()</li><li><strong>end() </strong>: This will return the end of the container. This can also be invoked in two ways ,similar to begin(): std::end(container) or container.end()</li><li><strong>cbegin()</strong> and <strong>cend()</strong> : These two are the const version of begin() and end(). These two return an object of <em>const_iterator</em> type which can’t be changed, while begin() and end() return <em>iterator</em> type, whose internal value can be changed.</li></ul><p><strong>Note</strong>: There are different types of iterators in C++ . They are also not limited to just containers as well. You can see more about them on <a href="https://en.cppreference.com/w/cpp/iterator">cppreference</a>.</p><p><strong>std::vector</strong></p><p>std::vector is a dynamic array data structure provided by C++ standard library. It is a generic container meaning it can hold almost any type, provided they satisfy some constraints. It has the ability to resize itself automatically when inserting or erasing an object.</p><p><strong>Common operations on std::vector</strong></p><ul><li><strong>push_back(element)</strong> : Appends the given element to the end of the container. There is alsoemplace_back(element)which can do what push_back does and more. This is done in amortized(average) O(1) time</li><li><strong>pop_back()</strong> : Removes the last element of the container. Calling this when vector is empty is an undefined behaviour (we don’t know what happens but its not good). O(1) time</li><li><strong>size()</strong> : Returns the current size of the vector. O(1) time.</li><li><strong>empty()</strong> : Returns true if the size of vector is 0 else returns false. O(1) time.</li><li><strong>clear()</strong> : Clears the content of the vector making the vector’s size 0. O(n) time, where n is the size of vector before calling clear().</li><li><strong>Access operations</strong> : <em>front()</em> , <em>back()</em> ,<em> at(index)</em> and<em> [] operator</em> are used for accessing elements. <em>front()</em> and <em>back()</em> do as their name suggests(return front of the vector and back of the vector respectively and will return garbage when called on empty vector or a segmentation fault happens). <em>at(i)</em> and <em>[i]</em> will both access element at index <em>i</em> but <em>at(i)</em> will do bounds check but <em>[i]</em> won’t. All of these operation are O(1) time.</li><li><strong>reserve(n) </strong>: Increase the capacity of the vector to a value that’s greater or equal to n. It will however not change the size of vector. Worst case linear time operation.</li><li><strong>Erasing elements </strong>: It has two variants,both taking iterators as parameters (one takes just one iterator , another takes in two iterators. It has worst case linear time complexity. erase(iter) variant will remove the element pointed to by the <em>iter </em>from the vector. erase(first_iter,last_iter) variant will remove all the elements in range [first_iter, last_iter).</li></ul><p><strong>std::vector in action</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40e6cbd28858c6f7610aa5f1c1015d79/href">https://medium.com/media/40e6cbd28858c6f7610aa5f1c1015d79/href</a></iframe><p><strong>std::stack</strong></p><p>The std::stack class is a container that gives us the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.</p><figure><img alt="Stack showing push(), pop() and top()" src="https://cdn-images-1.medium.com/max/216/1*BIhu0XS1DvbC7cU2hpCZlA.gif" /><figcaption><a href="https://cs.lmu.edu/~ray/images/stack.gif">Stack Data Structure</a></figcaption></figure><p><strong>Common operations on std::stack</strong></p><ul><li><strong>push(element)</strong> : Pushes element to the top of the stack. In dynamic stack such as std::stack , this operation will take O(1) amortized time. There is also emplace(element) which will do the same thing which will construct the element in-place without invoking copy or move constructor.</li><li><strong>pop()</strong> : Removes the top element from the stack. O(1) time.</li><li><strong>top()</strong> : Returns reference to the top element in the stack. O(1) time.</li><li><strong>size()</strong> : Returns the number of elements in the stack. O(1) time.</li><li><strong>empty()</strong> : Checks if the stack has no elements, returning true if it does else false. O(1) time.</li></ul><p><strong>std::stack in action</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f162413ec7f780e73b4cf5d5a816385/href">https://medium.com/media/2f162413ec7f780e73b4cf5d5a816385/href</a></iframe><p><strong>std::queue</strong></p><p>The std::queue class is a container that gives us the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure.</p><figure><img alt="Queue data structure showing front and back of the queue. It shows enqueue working on the back of the queue and dequeue working on front of the queue" src="https://cdn-images-1.medium.com/max/1024/1*HVKwDYYkTitsmyef_DRqqg.png" /><figcaption><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Data_Queue.svg/1200px-Data_Queue.svg.png">Queue Data Structure</a></figcaption></figure><p><strong>Common operations on std::queue</strong></p><ul><li><strong>push(element)</strong> : Pushes element to the back of the queue. This operation will take O(1) amortized time. There isemplace(element) for queue as well.</li><li><strong>pop()</strong> : Removes the front element from the queue. O(1) time.</li><li><strong>front()</strong> : Returns reference to the first element in the queue. O(1) time.</li><li><strong>size()</strong> : Returns the number of elements in the queue. O(1) time.</li><li><strong>empty()</strong> : Checks if the queue has no elements, returning true if it does else false. O(1) time.</li></ul><p><strong>std::queue in action</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd6a25e1a1214823ece69fdd5be43900/href">https://medium.com/media/cd6a25e1a1214823ece69fdd5be43900/href</a></iframe><p><strong>std::deque</strong></p><p>std::deque (double-ended queue) is an indexed sequence container that allows fast insertion and deletion at both its beginning and its end . As opposed to std::vector, the elements of a deque are not stored contiguously: typical implementations use a sequence of individually allocated fixed-size arrays, with additional bookkeeping. This is pretty useful container capable of giving us random access as well as constant time insertions at the back and the front. You must be thinking why do we even use std::vector or std::queue or std::stack when this container can perform all of their functionalities. This much power does have some cost. std::deque is not as cache friendly as std::vector is due to how its implemented. This is probably its major drawback, but it is unlikely you will notice this in most of the programming challenges you will encounter, so feel free to use std::deque without any worries. As for myself, I barely use it because I never felt like I needed it.</p><p><strong>Common operations on std::deque</strong></p><ul><li><strong>push_back(element)</strong> : Appends the given element to the end of the container. There is alsoemplace_back(element)which can do what push_back does and more. This is done in constant time.</li><li><strong>pop_back()</strong> : Removes the last element of the container. Calling this when vector is empty is an undefined behaviour (we don’t know what happens but its not good). Constant time operation.</li><li><strong>push_front(element)</strong> : Inserts element to the beginning of the deque. There is again an <em>emplace</em> variant for this called emplace_front(element) . This is again a constant time operation.</li><li><strong>pop_front()</strong> : Removes the first element from the deque. Again a constant time operation.</li><li><strong>size()</strong> : Returns the current size of the deque. Constant time operation.</li><li><strong>empty()</strong> : Returns true if the size is 0 else returns false. Constant time operation.</li><li><strong>clear()</strong> : Clears the content of the container making the it’s size 0. O(n) time, where n is the size before calling clear().</li><li><strong>Access operations</strong> : <em>front()</em> , <em>back()</em> ,<em> at(index)</em> and<em> [] operator</em> are used for accessing elements. <em>front()</em> and <em>back()</em> do as their name suggests(return front back of the the deque respectively and will return garbage when called on empty deque or it will give segmentation fault). <em>at(i)</em> and <em>[i]</em> will both access element at index <em>i</em> but <em>at(i)</em> will do bounds check but <em>[i]</em> won’t. All of these operation are O(1) time.</li><li><strong>Erasing elements </strong>: It has two variants,both taking iterators as parameters (one takes just one iterator , another takes in two iterators. It has worst case linear time complexity. erase(iter) variant will remove the element pointed to by the <em>iter </em>from the vector. erase(first_iter,last_iter) variant will remove all the elements in range [first_iter, last_iter).</li></ul><p><strong>std::deque in action</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3346d7f10f809f4f522cac3b23d23a20/href">https://medium.com/media/3346d7f10f809f4f522cac3b23d23a20/href</a></iframe><p><strong>std::list</strong></p><p>std::list is a container that supports constant time insertion and removal of elements from anywhere in the container. It doesn’t support constant time random access as with std::vector or std::deque . This is implemented as a doubly linked list. There is also another container in STL std::forward_list which is based on singly linked list but you won’t get bidirectional iteration with it unlike in std::list.</p><figure><img alt="A doubly linked list" src="https://cdn-images-1.medium.com/max/1024/1*W1AIi_g_a1oEG_BE45EqnA.png" /><figcaption><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Doubly-linked-list.svg/2560px-Doubly-linked-list.svg.png">Doubly Linked List</a></figcaption></figure><p><strong>Common operations on std::list</strong></p><p>Following are some of the common operations(with same functionality) that std::list has with std::deque :</p><ul><li>push_back(element)</li><li>pop_back()</li><li>push_front()</li><li>pop_front()</li><li>front()</li><li>back()</li><li>size()</li><li>empty()</li><li>clear()</li></ul><p>The operations that sets std::list apart from other containers is its ability to do constant time insertion anywhere in the list given that you have iterator to the position you want to insert it at. If you have iterator to 5th element(and its value be 100) in the list and you call lst.insert(it,10) , then 10 will become the 5th element and 100 will become 6th element in that list. You can insert a range of elements as well with lst.insert(it, start_it,end_it) which will basically insert range of elements [<em>start_it</em>,<em>end_it</em>) before <em>it. </em>This operation will take (end_it-start_it) time.</p><p><strong>std::list in action</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f8e5ed6ba492902494e4b2f6a26ac2d/href">https://medium.com/media/4f8e5ed6ba492902494e4b2f6a26ac2d/href</a></iframe><p><strong>Conclusion</strong></p><p>A lot was covered in this article and I hope you learnt something from this. This serves as introduction to some of the STL containers and I only included information that I thought were must knows and some common operations I find myself using from time to time. These containers can do much more than this and with iterators they compose well with different STL algorithms and other containers as well. To know more about these containers and other containers in STL , you can visit <a href="https://en.cppreference.com/w/cpp/container"><em>cppreference.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ef56a82dd41" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/stl-sundays-introduction-to-stl-containers-part-1-6ef56a82dd41">STL Sundays, Introduction to STL Containers (Part 1)</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to opensource and GSoC ]]></title>
            <link>https://medium.com/delta-force/guide-to-opensource-and-gsoc-d975e95a12c7?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/d975e95a12c7</guid>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Shashwat]]></dc:creator>
            <pubDate>Fri, 29 Oct 2021 13:24:47 GMT</pubDate>
            <atom:updated>2021-10-29T13:24:47.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*BK2weZ8mUd93KdyefIf0gQ.png" /><figcaption>Image Source: <a href="https://www.ictworks.org/how-can-open-source-software-be-sustainable-in-international-development/#.YXv1MIMzZhE">ictworks.org</a></figcaption></figure><p>Any software whose source code is publicly available for all to view or modify is often referred to as open source software (OSS). It’s generally free to use and redistribute, respects privacy, and has good community support because anyone can contribute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*hQAUdDp5AK4BQP14e4I3bA.jpeg" /><figcaption>Image Source: <a href="https://imgflip.com/i/22jtxt">imgflip.com</a></figcaption></figure><h3>Why contribute to open-source?</h3><p>There are several reasons why people contribute to open-source software. Some of them are:</p><ol><li><strong>Improves skills</strong> 💪: —When you make contributions such as fixing a bug in a codebase that may have been written by more than one person, it demonstrates that you can find, understand, and implement a fix for a part of the codebase (yes. very large body). In this way, you can learn the best methods and styles, as well as the way of thinking of other developers. Contributing to open source is often one of the best ways to eliminate “imposter syndrome”.</li><li><strong>Improves software that is used</strong> 👨‍💻: — Let’s say that you are using some open-source software and you come across a bug, or something isn’t behaving as you expect it to be. You could go to the software’s issue tracker and see if others have already noted this bug. If not, you could create a new issue and explain how to replicate it. If you already can think of a fix for it, you can just self-assign (or ask to be assigned) and submit the fix!</li><li><strong>Career growth</strong> 📈: — People who contribute to open-source projects might see new opportunities opening up for them. Companies reach out to you and might offer you to join them. Even with a few merged pull requests, you could use it to demonstrate what you can do!</li><li><strong>Makes one feel good</strong> 😇: — Even making a minor contribution to a project that many people depend upon is highly gratifying.</li></ol><h3>How to contribute to open-source</h3><blockquote>Contributing to open-source is not limited to just code contributions. If you are a graphic designer or love writing, some communities would love to see new UI mockups or improved documentation or tutorials for their projects.</blockquote><p>The following steps are general guidelines to follow while making a contribution. Some of these steps and how they are actually done may differ from organization to organization.</p><ol><li><strong>Find a project to contribute</strong> — Search for projects that use programming languages or tech stacks that you are familiar with and choose one. It is even better if the project you have chosen is related to a domain you are interested in. For example, blockchain, ML, networks &amp; security, tools for science &amp; astronomy, operating systems, etc. Also, make sure that the project is still active. This can be done by checking the last commit date or whether people are responding to issues and pull requests.</li><li><strong>Find an issue or feature to contribute</strong> — Once you have chosen a project, most people first check out the project’s issue tracker for issues to fix. This could be a separate site or GitHub/GitLab issues. Some issues might be labelled as “good first issue” or “low priority”, which mostly requires easy enough fixes aimed at first-time contributors.</li><li><strong>Check if anyone is working on it</strong> — Once you have found an issue you think you could fix, make sure no one else is working on it by checking the person assigned for that issue. Sometimes, there might be someone assigned, but that person could have been inactive for a long time. In that case, you could ask the project maintainers if it can be re-assigned to you.</li><li><strong>Write code</strong> — Implement your fix. Make sure to follow the organization’s contributing guidelines strictly and also make sure to run all necessary local tests successfully (if present) before pushing your code. Your code will not be reviewed unless you get the green check. This is to ensure that you don’t break anything else.</li><li><strong>Submit code for review</strong> — Once you have done that, review again if you have followed the contributing guidelines. If all is well, you may push and submit a pull request. Also, make sure to reference the issue you are fixing in your pull requests. Now request a review from the maintainers and make the suggested changes (if any). If all goes well, your pull request will be merged!</li></ol><p>If you get stuck at some point, even after reading their documentation or code walkthroughs, you can ask for help from the community. Organizations usually have public forums, mailing lists or chat rooms to discuss stuff related to their projects. Avoid asking queries in private.</p><p>There are several open-source programmes like <a href="https://summerofcode.withgoogle.com/">Google Summer of Code</a>, <a href="https://developers.google.com/season-of-docs/">Google Season of Docs</a>, <a href="https://fellowship.mlh.io/">MLH Fellowship</a>, <a href="https://linuxfoundation.org/about/diversity-inclusivity/mentorship/">Linux Foundations Mentorship Programs</a>, <a href="https://www.outreachy.org/">Outreachy</a>, etc. These programmes host various open-source organizations under them. Most of them are mainly for student developers new to open-source and offer great incentives. Apart from these, many universities host their own mentorship programmes to encourage and promote open-source culture in students. For example, there is <a href="https://dwoc.io/">DWoC</a> — a winter-long program organized by <a href="https://delta.nitt.edu/">Delta Force</a>, the coding club of NIT Trichy. Participating in programmes like these gives you a good idea and prepares you for other programmes like GSoC.</p><h3>Google Summer of Code 🌞:</h3><p>Google Summer of Code (GSoC) is a global program that matches students with open source, free software and technology-related organizations. They promote open-source culture by encouraging students to write code and become part of these communities while making some money along the way! The organizations provide mentors who act as guides through the entire process, from learning about the community to contributing code<a href="https://google.github.io/gsocguides/student/index">²</a>.</p><h3>Why is GSoC super cool ?</h3><ul><li>This allows novices/students to work with specialists.</li><li>The open-source development culture is fantastic! Nothing is hidden, and anyone can track your progress from anywhere. Even if you overlook a bug in your application, someone else may be able to detect and solve it!</li><li>Participation does not necessitate any expertise. You don’t need to pursue or possess a Computer Science degree. All you need are the skills and abilities to deal with the technology in question.</li><li>Good stipend — If your project goes well, you will be compensated generously!</li><li>Career Opportunities — Many participants have continued their careers in the direction of the project or domain they worked on over the summer.</li><li>Virtually meet and get to know new people! There were 1,286 accepted students from 69 countries for the 2021 season!</li></ul><h3>The Process</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*wIkWgUYocyIz2gK6.png" /><figcaption>GSoC timeline 2021</figcaption></figure><h4>Choosing Organization</h4><p>Usually in January<strong>,</strong> people start to study the organizations.</p><blockquote>Even if the selected <strong>organizations are not</strong> announced until March, <strong>there is</strong> a <strong>high probability</strong> that some of the <strong>them</strong> that participated this year will participate again next year!!!</blockquote><p>Choosing which organization to contribute to can be the most difficult decision a person has to make along the way! There are so many options to choose from, it’s hard to pick just one or two.</p><p>One approach that can help with the organization selection process is:</p><ul><li>Exploring the various organizations’ projects, domains, and technologies, using the GSoC archive page: <a href="https://summerofcode.withgoogle.com/archive/">https://summerofcode.withgoogle.com/archive/</a>.</li><li>Making a Google doc with short notes/summaries about organizations I’ve liked so far.</li><li>Determining the final 1–2 organizations from the doc through additional research.</li></ul><blockquote>Choosing an organization is a personal decision based on an individual’s interest in a particular domain or technology. An organization may be ideal for Person 1, but it may not be the same for Person 2.</blockquote><h4>Involvement with the organization</h4><p>The most important aspect of this is participating in the development process. Either by providing ideas or contributing to the codebase (identifying bugs, resolving issues, opening PRs/MRs, or documenting). Some organizations have a separate forum thread for each project with appropriate guidance on outcomes, while others require ongoing communication with maintainers.</p><p>The organization admins and mentors have always emphasized the importance of <strong>communication!.</strong> Most open source organizations have wikis, mailing lists, forums, or chat rooms where students can interact with project admins or mentors.</p><p>Scrolling through the history or looking at previous discussions can provide insight into what questions have been raised and what projects are of interest to the organization.</p><p>Helping others is also valuable, such as welcoming new members, assisting them in setting up their developer environment, and answering their questions!</p><blockquote>Organizations want students who have the potential of being long-term contributors.</blockquote><h4>Proposal</h4><p>The proposal is the main report that determines a student’s selection.</p><p>Continuous communication with the mentor is required from the moment of writing the proposal to completion. Ultimately, the project mentor decides which proposal to choose.</p><p>This year’s GSoC mentees took the initiative to collect proposals in a public git repository for future aspiring mentees to look into while planning their own proposal. <a href="https://github.com/Google-Summer-of-Code-Archive/gsoc-proposals-archive">https://github.com/Google-Summer-of-Code-Archive/gsoc-proposals-archive</a></p><h4>Community bonding and milestone finalisation</h4><p>The day of the selection of the proposals marks the start of the community bonding period. This time is primarily for the mentees to become acquainted with the organization, their mentors, and fellow mentees!</p><p>Things that people do during this period include creating user interface designs, documenting API endpoints, and setting up a development environment for the project.</p><h4>Coding period</h4><p>As soon as the coding period begins, people start working on the project at a breakneck pace.</p><p>In some cases, the mentor and mentee time zones might be completely different, making it more likely that someone will wake up late at night and communicate synchronously :), but fun and learning will always outweigh these little inconveniences.</p><p>Projects are always monitored and there are multiple assessments(evaluations) of them. Therefore, it is very important for the mentee to stay focused, and discuss if there are any problems or difficulties in completing the milestones with the mentors.</p><h4>Plan efficiently</h4><p>Each student is allowed to submit a maximum of three proposals. Many students try to game the system by submitting multiple proposals to maximize their chances of winning. Remember, <strong>quality triumphs quantity!</strong></p><p>Familiarize yourself with the GSoC timelines — they are unlikely to change. You have slim chances of receiving feedback on your proposal and making meaningful changes when you submit your proposal last minute.</p><h4>Learn from the past</h4><p>Suppose you are applying to an organization that has previously participated in GSoC. In that case, you will have the advantage of previous submissions. Investigate previous proposals as well as the <strong>mandatory blog posts</strong> where students document their progress.</p><p>You’ll gain a lot of insight into whether you’re the right fit for an organization, as well as feedback on what you can accomplish during the summer.</p><h4>Plan ahead</h4><p>The majority of the winning proposals demonstrate that the student understands the task at hand and can work full-time on the project. You are expected to work on the project for at least 30 hours per week on average. So plan ahead of time for the summer.</p><p>Make a clear list of what you believe should be accomplished and include it in your timeline. Remember that if you fail GSoC, you will lose your stipend as well as your reputation. So, when assessing your ability and timelines, be realistic.</p><p><strong>Finally Don’t overcommit!</strong></p><p>Thank you to everyone who read all the way to the end. Please accept this gift from our side: 🍨.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d975e95a12c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/guide-to-opensource-and-gsoc-d975e95a12c7">Guide to opensource and GSoC 🚀</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Explaining Explainable AI]]></title>
            <link>https://medium.com/delta-force/explaining-explainable-ai-da78ed5112a9?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/da78ed5112a9</guid>
            <category><![CDATA[xai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Saloni Rakholiya]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 12:27:10 GMT</pubDate>
            <atom:updated>2021-08-16T12:27:09.938Z</atom:updated>
            <content:encoded><![CDATA[<h4>Towards trusting (X)AI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*u4iVhp3hwWn3uMhIkSr6HQ.jpeg" /></figure><p>Be it personal assistants, automobiles or, social media, AI has taken over almost every aspect of our everyday life. Effort continues to be made to use AI to solve fundamental everyday problems. When we ask, “Will AI take over the world?” are we being dramatic, or is that a possibility? Well, it is stated that AI will outperform humans in various tasks and reduce the number of jobs by a significant amount very soon. Adding to it, just the fact that the $127 billion autonomous vehicle market is currently being driven by AI, is enough to prove how AI does have the possibility of taking over the world. The question here is about how “ok” it is for this to happen and can it really go wrong? One day, when you wake up, it is fine that a video recommended for you on YouTube is not as per your interest, but imagine a self-driving car not going as per your interest!? Crazy, isn’t it?</p><p>AI is being used in essential and risky domains to carry out tasks that can have significant consequences if decisions made by AI go wrong, be it in medicine, the military, or the automobile industry itself. Basically, the question lies around how much do we trust the AI algorithms to let it dominate our lives in a major way. Talking about AI and ML models, they can be broadly classified as white-box models and black-box models. These divisions are made with respect to getting a human explanation of models (post hoc methods), whereas the other alternative is developing interpretable models.</p><h4><strong>White-Box models</strong></h4><p>These are weaker and simpler models like linear regression or decision trees that are not essentially able to handle the complexities of datasets. They are easier to understand in terms of how they make decisions and thus are easily interpretable. For example, decision tree is a supervised learning technique (for regression and classification) where the tree’s leaf nodes are the output that tells us what decision the algorithm has made, and these are made on the basis of internal nodes, which represent dataset features.</p><h4><strong>Black-Box models</strong></h4><p>These are more complicated and “dangerous” models, which surprisingly show good performance and high accuracy. These include neural networks, gradient boosting models, random forest, etc., whose decisions are difficult to comprehend or work out by hand. These models are again of two types: Deep neural networks and proprietary algorithms. Deep neural networks have multiple neurons in each layer that hold values computed from previous layers, combined with several parameters which are difficult to construct manually. Proprietary algorithms, on other hand, are more about keeping the algorithm hidden from the users, but the AI experts who created the algorithms, know how these work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*nfN8Ou0aENyxiJ0AEb8rmw.jpeg" /><figcaption>The Tradeoff between Accuracy and Explainability of models (source: <a href="https://www.kdnuggets.com/2019/01/explainable-ai.html">kdnuggets</a>)</figcaption></figure><h3><strong>Why Explainable AI?</strong></h3><p>So why did I term black box models as “dangerous”? Well, as these models are not understandable by humans per se, implies that any errors or biases in the model can not be pointed out and corrected by us, both users and sometimes even the AI experts. The anonymity of decisions can make these algorithms go really wrong without us noticing it. Now, this is okay in recommendation systems, or social media feed, but the real problem arises when these models are implemented to make judicial decisions, medical decisions, or even calculating the credit score. These deadly consequences can cost us a lot, and thus, we need transparency in these models. By transparency, we mean knowing not just the decision but “how” the model arrived at a decision.</p><p>If we want to take prescriptions from AI, we need to be able to trust it, which is why making AI explainable is important. It is also our social right to just know the how and why behind AI decisions, that will affect us in some way or the other. Explainable AI will help us confirm if the algorithm is working right, allow us to improve algorithms when they go wrong or are subject to bias and errors, justify the decisions, prevent overfitting and underfitting as well as prevent harmful consequences.</p><p>Interpretability and explainability of AI and ML models are fairly debated on. Interpretability refers to knowing the cause and effects in the system. It’s like knowing you are most likely to catch a cold if you eat ice cream in winters. Explainability, on the other hand, refers to the “how” of the outputs. It’s like knowing why and how we fall sick when we eat ice creams in winter. To clear this up, explainable AI needs models to be both interpretable and explainable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*zymMdeV1iKeqzNkeX8CZIQ.jpeg" /><figcaption>Why explainable AI ? <a href="https://www.birlasoft.com/articles/demystifying-explainable-artificial-intelligence">(Source</a>)</figcaption></figure><h3><strong>Existing XAI Approaches:</strong></h3><p>Though explainable AI approaches have been classified with respect to the scope of explanation, data types as well as agnosticism, we will be looking into categorisation based on the type of explanation. Some of the traditional methods in an attempt to make AI more human-understandable are:</p><ul><li>Visual Explanation (Visualisation of data and model’s working)</li><li>Exploratory data analysis (example: data clustering)</li><li>Model Evaluation metrics (example: F1 score, precision, and recall)</li></ul><p>The above-stated methods are very generic and have limitations in interpreting the algorithms after deployment, due to changes in environment, noise, and data features, which leads to decreasing performance. Thus modern XAI model interpretation techniques and different libraries are now built to make AI more explainable. Some of them are listed below, which use techniques like feature importance, dependence plots, and surrogate model creation:</p><h4><strong>LIME (Local Interpretable Model-Agnostic Explanations)</strong></h4><p>This technique can be applied to any model (model-agnostic) to study how the input data gives the prediction. It tweaks one data sample (changes feature values ) and studies how it affects the output. LIME provides us with explanations as to why the decision was made in terms of its features and how each feature contributed to the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23W2czX4X5zpqeknpuCItQ.jpeg" /><figcaption>XAI using LIME (<a href="https://www.oreilly.com/content/introduction-to-local-interpretable-model-agnostic-explanations-lime/">Source</a>)</figcaption></figure><h4><strong>ELI5 (Explain Like I am 5)</strong></h4><p>A python package that provides explanations and helps debug ML classifiers. It lays out built functions that can be called to inspect model parameters as well as individual predictions.</p><h4><strong>SHAP (SHapley Additive exPlanations)</strong></h4><p>It is also a python package that offers a game-theoretic approach to provide explanations to the output. We use Shap values to read our model, which interprets how feature values affect the result if they hold a baseline value.</p><h4><strong>Tensorflow’s What-If tool (WIT)</strong></h4><p>WIT is used to analyse the model being deployed, to analyse black-box ML classification and regression models. This provides an interface to analyse model features, large datasets, and sub-datasets in visualized form, requiring no code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-OknK1zQqERotPDcoDn_w.png" /><figcaption>Visualization of data by WIT- Tensorflow (<a href="https://www.tensorflow.org/tensorboard/what_if_tool">Source</a>)</figcaption></figure><h3>Conclusion</h3><p>All I can say at the end is, artificial intelligence needs to be blended well with human intelligence to produce better and safer results, ensuring that when Sophia said, “Ok I will destroy humans” when interviewed at the SXSW technology conference, she doesn’t actually end up doing it. Attempt needs to be made to make all AI models around us more explainable so that we are in the loop with the model as to how the decisions are made, and we trust the AI enough to accept it and let it affect our lives.</p><h3>Resources</h3><ul><li><a href="https://analyticsindiamag.com/8-explainable-ai-frameworks-driving-a-new-paradigm-for-transparency-in-ai/">https://analyticsindiamag.com/8-explainable-ai-frameworks-driving-a-new-paradigm-for-transparency-in-ai/</a></li><li><a href="https://www.darpa.mil/program/explainable-artificial-intelligence">https://www.darpa.mil/program/explainable-artificial-intelligence</a></li><li><a href="https://towardsdatascience.com/explainable-ai-xai-a-guide-to-7-packages-in-python-to-explain-your-models-932967f0634b">https://towardsdatascience.com/explainable-ai-xai-a-guide-to-7-packages-in-python-to-explain-your-models-932967f0634b</a></li><li><a href="https://www.youtube.com/watch?v=AFC8yWzypss&amp;ab_channel=OpenDataScienceOpenDataScience">https://www.youtube.com/watch?v=AFC8yWzypss&amp;ab_channel=OpenDataScienceOpenDataScience</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da78ed5112a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/explaining-explainable-ai-da78ed5112a9">Explaining Explainable AI</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Death Of Traditional Programming]]></title>
            <link>https://medium.com/delta-force/the-death-of-traditional-programming-9453d8ec9491?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/9453d8ec9491</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[haskell]]></category>
            <dc:creator><![CDATA[RAGHUL NANTH]]></dc:creator>
            <pubDate>Sun, 25 Apr 2021 12:38:08 GMT</pubDate>
            <atom:updated>2021-04-25T12:46:13.482Z</atom:updated>
            <content:encoded><![CDATA[<p>Nope, this is not related to AI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsfIEk9dn_XqpK2wi43UuA.png" /></figure><p>Programming is a moderately fun and rewarding activity, for the most part. But, have you ever looked at a piece of code and thought, “Man, I like this, but I really wish that this was crammed with a whole bunch of mathematics”? Oh, never. Well, a bunch of nerds in the computer science community, i.e., the super nerds got together in the ’50s to do just that. And so was born, functional programming, today’s new buzzword.</p><h3>The beginnings</h3><p>In the beginning, there was manual calculation. Then Turing said, let there be mechanization, and thus was born the Turing Machine. Then, came Alonzo Church, who said, let there be a formal system of computation built from a functional application, which led to the creation of Lambda Calculus. And thus was born from this, the functional paradigm.<br> Although the inner workings of lambda calculus itself are not important for the conversation at hand, it is worth knowing the basics, since it forms the basis for this entire paradigm of programming. So, at a basic level, it is a mathematical model of computation that involves binding values to function parameters and applying said functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*MZQlv0iot21kRqNXSYplEA.png" /><figcaption>Here is an example of the identity function expressed with lambda notation</figcaption></figure><h3>Motivation</h3><p>Code, while simple in theory, has a myriad of ways to manifest itself when we try and realize it in practice. There are multiple ways to define a solution for any provided task. Traditional programming, also known as imperative programming, is a model where we provide the computer with a set number of instructions to follow to accomplish the provided goal. While this has the advantage of being easy to learn and understand on a smaller scale, as the scale increases, the sheer volume can make reasoning through the code and understanding everything pretty tough, which can lead to unforeseen problems in the codebase.</p><p>The functional approach, on the other hand, aims to sidestep a lot of the problems faced by the imperative style of programming. In this style of programming, we do not provide the computer with the steps to complete a certain task, rather only describing what the program is supposed to compute.</p><p>But how do we do that? And as the name suggests, we accomplish this with the help of functions, by applying them or composing them with other functions, a throwback to its heavy mathematical influences. At its purest, a functional program consists of functions that can take in inputs and provide an output. It doesn’t have the ability to change the inputs provided or the other states of the outside calling program in any way. This pushes the functions used in this paradigm more in line with the definition of a mathematical function, and because of this, the behavior of all functions can be completely analyzed and understood, and it can also guarantee data integrity because of its <strong>immutable</strong> nature.</p><p>Now, you might be thinking, yeah, that is cool and all, but why would I want to learn a completely new set of rules when the current system works without any problems? With ever-growing technological advancements, we currently reside in a time, where storage is extremely cheap and can be easily and efficiently accessed by your programs, but the only way to increase performance is with multi-processing, which is an extremely tedious process, because of the mutability of data, which, as mentioned before, is a complete non-problem here, allowing for easy parallel processing.</p><p>There are other little improvements that it provides in the form of smaller and more understandable codebases, etc. To know about the other improvements a functional approach can provide for your development process, we will be looking at some of the other features that it provides.</p><h4>Higher-Order Functions</h4><p>These are functions that can take in other functions as inputs or return them as the output. This can help us generate code that is easier to understand and allow us to better reason. Here’s an example. <br> Let us try to get the sum of an array.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2eb478ef4cb205b2ba24f9ff623dd3c9/href">https://medium.com/media/2eb478ef4cb205b2ba24f9ff623dd3c9/href</a></iframe><p>As we can observe, the functional approach is much simpler and uses a higher-order function reduce, which takes in a function that sums up the numbers, starts the count at 0, and returns the sum required. Now, you might have noticed that this function inside reduce doesn’t really have a name. And that is because of the concept known as <strong>anonymous functions</strong>. They owe their origin, like most things in this paradigm to lambda calculus.</p><p>Higher-order functions also allow for some even more cool applications like <strong>currying</strong> or <strong>partial application</strong>, which is the property that allows you to only provide certain arguments to a function, which then returns a new function that already has some of its parameters bound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZXL5ot8Bl_TcGWhzzfTfA.jpeg" /><figcaption>Has nothing to do with currying itself, but hey, does look pretty tasty right?</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d00a79b63537fa857e93e529128e5c6/href">https://medium.com/media/2d00a79b63537fa857e93e529128e5c6/href</a></iframe><p>As we see in the example given above, the first function takes two arguments and returns their sum as the answer. The second variable stores the partially applied function with 2, which means that the last line provides the output 5 since x is already bound. This allows us to use functions in a completely novel and useful way.</p><h4>Pure functions</h4><p>As previously stated, functions don’t have the ability to modify the state of the program as a whole and are said to have no side effects. This, though can seem trivial, has some pretty nice benefits attached to it.</p><p>For example, in today’s world of a constant push towards parallel processing, the immutability of data in a functional setting can alleviate a lot of the bugs that are caused by data dependencies and various other race conditions in the traditional approach. This lack of side effects also allows a compiler to better alter the ordering of the program for better efficiency since the evaluation of one is independent of another, which can lead to great efficiency improvements.</p><h4>Recursion</h4><figure><img alt="An example of a tree built on the principles of recursion" src="https://cdn-images-1.medium.com/max/380/1*P-1IDuf--Tw586bc7VMPvA.jpeg" /><figcaption>An example of a tree built on the principles of recursion</figcaption></figure><p>Now, recursion, as a concept is pretty universal in nature. But they are one of the most important concepts in this paradigm since the function of a loop is accomplished with the help of recursion.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d373239cd68d9a6e21c706fba07fd4d/href">https://medium.com/media/8d373239cd68d9a6e21c706fba07fd4d/href</a></iframe><p>In the above example, we implement a program to obtain an initial value, and then sum up all the numbers up to the given one, with the help of recursion. Now, multiple definitions of a function might seem weird at first, but this is similar to how functions are defined in mathematics, where based on the domain, we can apply a different function.</p><h4>Lazy Evaluation</h4><p>This is a concept where a value is not evaluated until it is necessary. For example, here</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b98580a6daf5b9395d52b3cdbfbe8a9/href">https://medium.com/media/1b98580a6daf5b9395d52b3cdbfbe8a9/href</a></iframe><p>Here the first element is undefined, which, if evaluated, throws an error, but if we try to run this program, it returns 2, with no errors. This is because the values inside the array aren’t necessary to calculate the length of the array and, are hence never evaluated, hence cause no errors.</p><p>Another example, that is comparatively a bit more interesting, can be shown with the help of <strong>infinite lists</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08708d4807cb1e0fd33322ddc6f1aafa/href">https://medium.com/media/08708d4807cb1e0fd33322ddc6f1aafa/href</a></iframe><p>As we can see here, the <strong>fibs </strong>list is an infinitely generated list, that starts with the values of 0 and 1, and the rest are generated in accordance with the <strong>Fibonacci sequence</strong>. The interesting thing is, even though we have asked the program to calculate an infinite list, a technically impossible feat is achieved by Haskell through the aforementioned <strong>lazy evaluation</strong>, under which, until we ask for data from the structure, none of it is ever evaluated.</p><h3>Conclusion</h3><p>Now, what we have discussed so far only encompasses the basics of the functional approach. But, it serves as an introduction to this new concept, that even if you don’t ever start programming in a functional language, still allows you better your code with a more functional approach wherever possible. It also allows provides you with a new set of buzzwords to brag to your friends about, so, hey, that’s great too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9453d8ec9491" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/the-death-of-traditional-programming-9453d8ec9491">The Death Of Traditional Programming</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privacy Issues in the Public Web]]></title>
            <link>https://medium.com/delta-force/privacy-issues-in-private-data-ae62b8ae133?source=rss----b1bcd9f7878---4</link>
            <guid isPermaLink="false">https://medium.com/p/ae62b8ae133</guid>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[IndreshP]]></dc:creator>
            <pubDate>Tue, 20 Apr 2021 09:45:35 GMT</pubDate>
            <atom:updated>2021-04-20T10:10:18.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kjwso46HLZvKJeRewCj0g.jpeg" /></figure><p>Often when we are stranded in some deserted place and need of some food, we’ll take our mobile phone and search for “nearest bakery.” The first bakery in the search results is just within a kilometer radius. How does our mobile phone know about our location?</p><p>Apps, websites have made us relish the world within our palms. We have boundless information in a single touch. But we never realize, our data is also gathered and processed at the same time.</p><h3><strong>How is personal data getting collected?</strong></h3><h4><strong>1) IP address:</strong></h4><p>In a network, we send and receive information. Usually, in our day-to-day life, we use letters to send and receive messages. We write our and the receiver’s postal addresses to locate each other. Similarly, on the internet, we send and receive data. Along with the data(the content of the letter) address has to be written. Hence we use an IP address, which acts in a similar way that an address works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*ZcxnbjZcOXvE5hq9NF5LBw.jpeg" /><figcaption>Image of a packet(letter) that has to be sent and received on the internet</figcaption></figure><p><strong><em>How do we find our IP address?</em></strong></p><p>There are two IP addresses:</p><ol><li><strong>Public IP address</strong></li></ol><p>A public IP address is the globally specific IP address assigned to a computer device, like the postal address used to send a postal email to your home. We can find our public IP address on <a href="https://whatismyipaddress.com/">What’s My IP Address</a> or <a href="https://api.ipify.org/?format=json">IPFY</a>.</p><p>2.<strong> Local IP address/Private IP address</strong></p><p>A private IP address is used to locate our device within the network. When we are using a Wi-Fi router in our house, the router has a public IP address, and every device has a private IP address. Again this is similar to the postal process. We receive a letter at our house address. But only one resident reads it; our public IP acts like house address and private IP address like the recipient’s name.</p><p>In Windows 10,</p><ol><li>Click the Start icon and select Settings.</li><li>Click the Network &amp; Internet icon.</li><li>To <strong>view</strong> the <strong>private</strong> <strong>IP address</strong> of a wired connection, select Ethernet on the left menu pane and select your network connection; our <strong>IP address</strong> will appear next to “<strong>IPv4 Address</strong>”.</li><li>To view the <strong>private IP address</strong> of a wireless connection, select Wi-Fi on the left menu pane and click <strong>Hardware Properties</strong>; our IP address will appear next to “IPv4 Address”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*42zVMZ3s54p1sG82uv5kOA.jpeg" /></figure><blockquote><strong>IP</strong> stands for “Internet Protocol,” which is the set of rules governing the format of data sent via the internet or local network. An <strong>IP address</strong> is a 32-bit number. It uniquely identifies a host (computer or other devices, such as a printer or router) on a TCP/<strong>IP</strong> network. <strong>IP addresses</strong> are usually expressed in dotted-decimal format, with four separated periods, such as 172.16.254.1.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DNi8QDUAEHshhyP2q9b9yA.png" /></figure><p>An IP address is not random; it is mathematically produced and allocated by the Internet Assigned Numbers Authority (IANA), an Internet Corporation division for Assigned Names and Numbers (ICANN).</p><blockquote><strong><em>Threats</em></strong></blockquote><blockquote>Cybercriminals may use different techniques to perceive IP address. Attackers can use <a href="https://en.wikipedia.org/wiki/Social_engineering_(security)"><em>social engineering</em></a> to trick into revealing the IP address. Cybercriminals can impersonate with IP address, to download illicit content and anything else they do not want to be tracked back to them. Criminals will attack network as well and initiate a range of assaults. <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack">DDoS (distributed denial-of-service)</a> attacks are one of the most common attacks on the network.</blockquote><p>Websites or apps collect IP addresses to locate, find <a href="https://en.wikipedia.org/wiki/Internet_service_provider"><em>Internet Service Providers (ISP)</em></a>, etc. There is a common misbelief that turning off location in devices can stop tracking location.</p><p>ISP usually sets up a connection when connected to the internet. It tracks via an IP address. Network traffic is routed through ISP’s servers, which can log and display everything we do online</p><h4><strong>2) Cookies:</strong></h4><p>Developers tend to analyze and track us to know our identity, interests, etc., and enrich our user experience. For this purpose, many techniques are used; among them are cookies.</p><p>We can locate cookies in cookies storage:</p><ol><li>Click<strong> F12</strong> after visiting a website to open developer tools.</li><li>Move to the <strong>Application </strong>tab.</li><li>Left side, in the <strong>Storage </strong>pane, click on <strong>Cookies.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*_WajrcVZhTk9sbFIf7SheQ.png" /></figure><blockquote>An HTTP cookie (web cookie, browser cookie) is a small piece of information sent to the web browser by a server. It can be cached by the browser and sent back with subsequent requests to the same server.</blockquote><p>Cookies are mainly used for three purposes:</p><ol><li><strong>Session management: </strong>Logins, game scores, or anything else the server should remember</li><li><strong>Personalization: </strong>User preferences, themes, and other settings</li><li><strong>Tracking: </strong>Recording and analyzing user behavior</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*1G7GdxoDWvGCVmH0svWbDw.jpeg" /></figure><h4><strong>Third-party cookies</strong></h4><p>A cookie is associated with a domain. The cookie is a first-party cookie if the domain is the same as the page visited. It is a third-party cookie if the domain is different. Although first-party cookies are set by the server hosting a website, the page may contain images or other components stored on servers in separate domains (e.g. ad banners), which may set third-party cookies. These are mainly used for advertising and tracking across the web.</p><p>When visiting several pages, a third-party server can create a profile of a user’s browsing history and preferences based on cookies sent to it by the same browser. Browser settings or extensions can block third-party cookies (or just tracking cookies).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*8iTuuY9cUcmT6hC_-vB44A.jpeg" /></figure><blockquote>“Whenever a website is visited, the user will be often prompted with an offer of cookies. Cookies can collect our personal information to the amount of time a particular meme is viewed. While cookies are an important component of the modern web, they pose a significant risk of invasion of privacy and a security risk.”</blockquote><h4><strong>3) Browser Fingerprinting:</strong></h4><p>To track us even when cookies are disabled on the browser and for unique identification, methods such as browser fingerprinting, pixel tags, etc., are used. Characteristics of one person are different from another. Similarly, the configuration of one device or browser is different from another. This dissimilarity is analyzed and used for the unique identification of our device.</p><blockquote><em>A device fingerprint, machine fingerprint or browser fingerprint is information collected about a remote computing device for identification. Fingerprints can be used to fully or partially identify individual users or devices even when cookies are turned off.</em></blockquote><p>Browser fingerprinting is a powerful tool used by websites to gather information about the version and type of browser, specifics of the operating system, active plugins, language, time zone, screen resolution, and various other active settings.</p><p>At first, these data points can seem generic and do not look personalized to identify one particular individual. There is, however, a considerably small chance for another user to have 100 percent matching results. Websites use the information provided by browsers to identify specific users and monitor their online actions. This approach is called ‘browser fingerprinting.’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*3jEcLOQcOL6yExvaWC5hnA.png" /></figure><p>“Canvas Fingerprinting” is the modern way to get browser information. It is a tiny piece of code within the code that takes the fingerprint of our browser.</p><blockquote><em>“When a user visits a page, the fingerprinting script first draws text with the font and size of its choice and adds background colors. Next, the script calls </em><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL"><em>Canvas API’s ToDataURL</em></a><em> method to get the canvas pixel data in the data URL format, </em><a href="https://en.wikipedia.org/wiki/Base64#:~:text=In%20programming%2C%20Base64%20is%20a,specific%20MIME%20content%20transfer%20encoding."><em>a Base64 encoded </em></a><em>representation of the binary pixel data. Finally, the script takes the </em><a href="https://en.wikipedia.org/wiki/Hash_function"><em>hash</em></a><em> of the text-encoded pixel data, which serves as the fingerprint.”</em></blockquote><p>The HTML5 canvas element generates details, such as the font size and the active background color settings of the browser, on a website. Such data acts as a specific fingerprint.</p><p>Canvas fingerprinting does not load something onto the computer, unlike how cookies work, so we would not remove any data, as it is stored online.</p><h3><strong>What do they do with data?</strong></h3><p>The data gathered is mainly used to improve the user experience. But these data can also be used to influence. The influence ranges from personalized ads to search results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WijxwAMcNBl_0XC8ahwhaw.jpeg" /></figure><p>Using information such as age, location, app usage, and even data from the mobile websites browsed, we are profiled into categories that advertisers can use to target ads. The targeting categories are broke into subcategories including, <strong>Demographics</strong>, <strong>Interests,</strong> and <strong>Behaviors.</strong></p><ul><li><strong>Demographics</strong> are used to reach individuals based on schooling, employment, finance, income, language, and lifestyle.</li><li><strong>Interest</strong> is used to match individuals based on posts in social media, searches.</li><li><strong>Behaviors</strong> are used to check individuals based on buying preferences or intentions, the use of technology, and more.</li></ul><p>Our data is safe until it remains in safe hands.</p><h3><strong>How can we make sure we are safe?</strong></h3><h4><strong>1. Private browsing</strong></h4><p>It’s always safe to use our network to surf. When we use some public network connection or anonymous wi-fi, there is a threat to our activity logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*PoVKHokkqtSR-i_ssF-arA.jpeg" /></figure><p>We can always browse privately, sign out of our account, change our custom results settings, or delete past activity. We can read the terms and conditions to know more about how data is being used.</p><h4><strong>2. Third-party cookies</strong></h4><p>Disabling third-party cookies in the web browser can stop advertisers and other third-party entities from tracking. It enhances user privacy and security. It’s always a good idea to periodically clear out third-party cookies.</p><ol><li>In Chrome, at the top right, click More.</li><li>Click More tools. <strong>Clear browsing data</strong>.</li><li>At the top, choose a time range. To delete everything, select <strong>All time</strong>.</li><li>Next to “<strong>Cookies</strong> and other site data” and “Cached images and files,” check the boxes.</li><li>Click <strong>Clear</strong> data.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*hEOL0RVhlythxGJNkNDEPg.png" /></figure><h4><strong>3. VPN</strong></h4><p>In the postal system, if the letter is sent and received through a service provider who sends and receives letters in his name, without disclosing our identity and encoding our data such that only sender and reader can understand, our data and identity are safe. VPN provides such a service.</p><blockquote>VPN stands for <strong>“Virtual Private Network”</strong> and describes the opportunity to establish a protected network connection when using public networks. VPNs encrypt our internet traffic and disguise your online identity. It makes it more difficult for third parties to track activities online and steal data.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ghA1IDFydDMuC9l2odUAIg.jpeg" /></figure><p>A VPN connection disguises online data traffic and protects it from external access. Unencrypted data can be viewed by anyone who has network access and wants to see it. With a VPN, hackers and cybercriminals can’t decipher this data.</p><p><strong>Benefits of VPN</strong></p><ul><li><strong>Secure encryption:</strong> We need an encryption key to read the data. Without one, a brute force attack will take years to decode the code. Our online activities are hidden even on public networks by using a VPN.</li><li><strong>Disguising our whereabouts</strong>: On the internet, VPN servers act as proxies. With VPN, demographic location data comes from a server in another region; hence, it is impossible to determine the actual location. Besides, our activities are not recorded by most VPN services. It implies that any potential user behavior record is hidden.</li></ul><p>In this online world, it’s a fact that nothing can be hidden. We have to accustom that our data is getting collected and used. But we can still reduce being tracked.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae62b8ae133" width="1" height="1" alt=""><hr><p><a href="https://medium.com/delta-force/privacy-issues-in-private-data-ae62b8ae133">Privacy Issues in the Public Web</a> was originally published in <a href="https://medium.com/delta-force">Delta Force</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>