<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Archit on Medium]]></title>
        <description><![CDATA[Stories by Archit on Medium]]></description>
        <link>https://medium.com/@garg4ag?source=rss-4393e5f0c5d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*F0pxPSYcl1TWur1XlmBqkQ.jpeg</url>
            <title>Stories by Archit on Medium</title>
            <link>https://medium.com/@garg4ag?source=rss-4393e5f0c5d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:21:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@garg4ag/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[FIFA20 Data Analysis]]></title>
            <link>https://medium.com/@garg4ag/fifa20-data-analysis-824f60954831?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/824f60954831</guid>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[fifa-20]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nanodegree]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Fri, 20 Mar 2020 05:42:14 GMT</pubDate>
            <atom:updated>2020-03-20T06:08:00.119Z</atom:updated>
            <content:encoded><![CDATA[<h4>Predict the best position?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*IB7tanrvic9QMM5yUKOxQA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*jz_YuJQYLnYLNdiqns89bA.jpeg" /></figure><h3>Introduction</h3><p>FIFA 20 is a football simulation video game published by Electronic Arts as part of the FIFA series. It is the 27th installment in the FIFA series, and was released on 27 September 2019 for Microsoft Windows, PlayStation 4, Xbox One, and Nintendo Switch.</p><p>The dataset contains information of all 18278 players from the latest edition FIFA 20. There are 104 attributes including Nationality, Club, DateOfBirth, Wage, Salary, attributes with statistics as Attacking, Skills, Defense, Mentality, GK Skills, etc.</p><p>There were more than 100 questions as a part of the analysis, including:</p><blockquote>“What’s the ratio of total wages/ total potential for clubs. Which clubs are the most spends most on player potential?”</blockquote><blockquote>“What’s the age distribution like? How is it related to player’s overall rating?”</blockquote><blockquote>“Predict the best position”</blockquote><p><strong>Q1: What’s the ratio of total wages/ total potential for clubs. Which clubs are the most spends most on player potential?</strong></p><p>According to this Real Madrid spend most on the player potential. Including Real Madrid, FC Barcelona, Man City willing to spend much more wage for high potential players than average clubs. This is how they stay competitive in leagues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*MGqobo9mXUd_J5TWUFXVYQ.png" /></figure><p><strong>Q2: What’s the age distribution like? How is it related to player’s overall rating?</strong></p><p>We can see that most players are between 20–27 years old. And players’ number start to decrease after 27 years old and speed up after 30. Reason behind this could be that many young player didn’t get enough opportunities to prove themselves and give up their dream as a football player.</p><p>When a football player reaches their late 20s, they have gain enough experience and reaches peak of their rating. The golden era of a football player starts here and ends when his age reaches 35. At this age, his physical body condition drops quickly so as average rating.</p><p>There are also quite a few numbers of players with age over 37, 38 years old. This is quite a surprise especially their rating still can remain quite high.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*fuPLUjKQ04_YuovPvDGu6A.png" /></figure><p><strong>Q3: Predict the best position?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WdhvhwShWxzMJmJa-KacNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxLgbnTix3UKoxL6JuY46w.png" /></figure><p>Egypt, Israel, Gabon, Cape Verde… etc are on the list, while we don’t see traditionally strong countries such as Germany, Netherlands and France here. This is probably many low level leagues are included, making the spectrum much wider.</p><p><em>A few observations:</em></p><blockquote>We are classifying all WingBacks as SideBacks. In fact, these 2 roles are quite similar while WingBacks are a bit more like an attacker. Examples would be A.Cole, Marcelo.<br>Fwd Wingers are usually classified as side midfielders or centre forward. In fact, functions of LW &amp; RW are exactly the combination of LM/RM and CF/ST. Classical examples will be L.Messi and Cristiano Ronaldo!<br>Having more attributes is certainly improving the accuracy.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJF-qr2QIC9uCRul0bPU2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WYS1CPn28VUK1eERpJuUHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*1yOaPfZS5d9ciVOzIwEhDg.png" /></figure><p><strong>Conclusion</strong></p><p>In this blog post, we explored FIFA 20 player dataset from Kaggle and got some interesting findings.</p><ol><li>We found that money plays a crucial part in a club’s performance. The clubs like Real Madrid, FC Barcelona, Man City are willing to spend much more money on their players.</li><li>There were quite a few football players didn’t continue their career after 27 years old. This is quite a cruel number which reflects how competitive this profession is. But there was also player even more than 40 years old. True love prevails!</li><li>The heatmap tells the requirement of each position:</li></ol><ul><li>Centre Defeners: Good Physic, such that you won’t get crushed by the strikers</li><li>Side (Wing) Defenders: Good defending skills and dribbling skills. You are the one to stop the counterparts and start your attack.</li><li>Centre Midfielders: Good dribbling and passing skills is a must! You are connecting everyone in your team.</li><li>Side Midfielders: Good passing skills and shooting skills would be useful. You are a great assistant to the strikers.</li><li>Forward Wingers: Good shooting skills with fast pace are the definition of wingers. You are the attacker from the side.</li><li>Centre Forward: Good dribbling and shooting skills is a must. Sometimes good physic can give you extra advantage to crush the defenders in the air!</li></ul><p>To see more about this analysis, see the link to my <a href="https://github.com/gargarchit/Data-Science-Blog-Post_Udacity-Project">Github</a> available here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=824f60954831" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Loading Image using PyTorch]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/loading-image-using-pytorch-c2e2dcce6ef2?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2e2dcce6ef2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[image-loading]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 09:09:55 GMT</pubDate>
            <atom:updated>2019-07-12T09:09:55.097Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Import torchvision #easiest_way</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pRLb3pLyEgnSYS8ZebrMPg.png" /></figure><p>In this Article, I’ll show how to load image data, it will be really useful while doing real projects. PyTorch is the newly released deep learning framework and is easy to use. Tensors are the building block of PyTorch and this is similar to NumPy array or matrix. PyTorch also can use GPU which enable the data preprocessing faster and that’s the reason we can use PyTorch in replacement of NumPy. Also, we convert a NumPy array or matrix to PyTorch Tensor and vice-versa.</p><p>Let us start, <br>I’ll be using a data set from<a href="https://www.kaggle.com/c/dogs-vs-cats"> kaggle i.e cat and dog photos</a>. Hence example image from this data set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*vZE-LKuvkWq3OBUDJRF-pg.jpeg" /><figcaption>woff_meow</figcaption></figure><h4>1. Loading dependencies</h4><p>The easiest way to load image data is by using datasets.ImageFolder from torchvision so, for this we need to import necessary packages therefore here I import matplotlib.pyplot as plt where matplotlib is a 2D Plotting library for displaying image as well as I import torch and datasets and transforms from torchvision and helper module. Let’s see the code:</p><pre>%matplotlib inline<br>%config InlineBackend.figure_format = ‘retina’</pre><pre>import matplotlib.pyplot as plt</pre><pre>import torch<br>from torchvision import datasets, transforms</pre><pre>import helper</pre><h4>2. Transform</h4><p>In general we use ImageFolder as</p><p>dataset = datasets.ImageFolder(&#39;path&#39;, transform=transform)</p><p>where ‘path’ is the path to the data set which the path to the folder where the data is present and while loading data with ImageFolder we need to define some transforms because images are of different sizes and shape and we need all image in training set to be of the same size for training. Therefore we define resize with transform.Resize() or crop with transforms.CenterCrop(), transforms.RandomResizedCrop() also we need to convert all the image to PyTorch tensors for this purpose we use transforms.ToTensor(). Also, we will combine this transforms to pipeline with transforms.Compose(), which run the list of transforms in sequence. so finally we define transform as:</p><pre>transform = transforms.Compose([transforms.Resize(255),<br>                                transforms.CenterCrop(224),<br>                                transforms.ToTensor()])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*7Tv2UBfWz2GTynTTd_1qIg.png" /><figcaption>Rescale, Crop and compose</figcaption></figure><h4>3. Data Loaders</h4><p>After loaded ImageFolder, we have to pass it to DataLoader. It takes a data set and returns batches of images and corresponding labels. Here we can set batch_size and shuffle (True/False) after each epoch. For this we need to pass data set, batch_size, shuffle into torch.utils.data.DataLoader() as below:</p><pre>dataloader = torch.utils.data.DataLoader(dataset, batch_size=32, shuffle=True)</pre><h4>4. Testing Data Loader</h4><p>Now, to test the data loader we need to run:</p><pre>images, labels = next(iter(dataloader))<br>helper.imshow(images[0], normalize=False)</pre><p>here, data loader is a generator and to get data out of it, we need to loop through it or convert it to an iterator and call next()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmcZ8osms2UK9cJOP7XyhA.jpeg" /><figcaption>Data Loader</figcaption></figure><h4>Let us see the complete code for transforming and loading data:</h4><pre>data_dir = ‘Cat_Dog_data/train’</pre><pre>transform = transforms.Compose([transforms.Resize(255),<br>transforms.CenterCrop(224),<br>transforms.ToTensor()])<br>dataset = datasets.ImageFolder(data_dir, transform=transform)<br>dataloader = torch.utils.data.DataLoader(dataset, batch_size=32, shuffle=True)</pre><pre>images, labels = next(iter(dataloader))<br>helper.imshow(images[0], normalize=False)</pre><p>After Loading we will see an image from the dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*kNdaO7lgrwxmiK_f6HbeIg.jpeg" /><figcaption>Output</figcaption></figure><h4>5. Introducing Randomness</h4><p>We can randomly rotate, mirror, crop, scale image during training, which will help our network generalize as it’s seeing the same image but in a different location, with different orientation and size.</p><p>To randomly rotate, scale, crop, and horizontal flip, we define transforms like this:</p><pre>train_transforms = transforms.Compose([<br>                                transforms.RandomRotation(30),<br>                                transforms.RandomResizedCrop(224),<br>                                transforms.RandomHorizontalFlip(),<br>                                transforms.ToTensor()])</pre><h4>6. Normalizing the image</h4><p>We can normalize the image with transforms. Normalize, for this, we need to pass the list of means, list of standard deviations, then the color channels as:</p><p>input[channel] = (input[channel] - mean[channel]) / std[channel]</p><p>Here, subtracting mean centers the data near zero and dividing by standard deviation squishes the values to be between -1 and 1. Hence, Normalizing helps to keep the Network weights near zero which in turn makes back propagation more stable. Without normalization, the network will fail to learn properly.</p><h4>7. Final Result:</h4><pre>data_dir = ‘Cat_Dog_data’</pre><pre>#Applying Transformation<br>train_transforms = transforms.Compose([<br>                                transforms.RandomRotation(30),<br>                                transforms.RandomResizedCrop(224),<br>                                transforms.RandomHorizontalFlip(),<br>                                transforms.ToTensor()])</pre><pre>test_transforms = transforms.Compose([transforms.Resize(255),<br>                                      transforms.CenterCrop(224),<br>                                      transforms.ToTensor()])</pre><pre>train_data = datasets.ImageFolder(data_dir + ‘/train’,  <br>                                    transform=train_transforms)                                       <br>test_data = datasets.ImageFolder(data_dir + ‘/test’, <br>                                    transform=test_transforms)</pre><pre><br>#Data Loading</pre><pre>trainloader = torch.utils.data.DataLoader(train_data,<br>                                                   batch_size=32)<br>testloader = torch.utils.data.DataLoader(test_data, batch_size=32)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*HdXfhvyTzYbNV2VzHMdOpQ.png" /><figcaption>Result</figcaption></figure><h4>Resources</h4><ol><li>Data set: <a href="https://www.kaggle.com/c/dogs-vs-cats">https://www.kaggle.com/c/dogs-vs-cats</a></li><li>Documentation: <a href="https://pytorch.org/docs/0.3.0/torchvision/transforms.html">https://pytorch.org/docs/0.3.0/torchvision/transforms.html</a></li><li>Tutorial: <a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html">https://pytorch.org/tutorials/beginner/data_loading_tutorial.html</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2e2dcce6ef2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/loading-image-using-pytorch-c2e2dcce6ef2">Loading Image using PyTorch</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of AI: Federated Learning]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/the-future-of-ai-federated-learning-fe977cdd3c62?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe977cdd3c62</guid>
            <category><![CDATA[udacityfacebookscholar]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[federated-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Sun, 30 Jun 2019 08:33:01 GMT</pubDate>
            <atom:updated>2019-06-30T13:06:43.577Z</atom:updated>
            <content:encoded><![CDATA[<h4>A closer step towards Federated Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*dONt6-nHM0cmlfQzDs57jA.png" /><figcaption>Federated Learning</figcaption></figure><p>Federated Learning is a technique for <strong><em>training Deep Learning</em></strong> <strong><em>models</em></strong> on data to which you do not have access, so basically, instead of bringing all the data into one machine in the cloud and training a model. we’re going to bring that model to the data, train it locally wherever the data lives and merely upload model updates to the central server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3gmE97go113UXd-HuSeKA.png" /></figure><p>The idea is that whoever is creating the data will own the data and we can learn from them without learning about them. Pretty cool, eh?</p><p>The challenge of federated Learning is to learn a model with minimal information over-read between client and the curator</p><h3>Is the model gonna keep learning as I use it?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oEarfXACeOsUQdMhNwX8PA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nl-vfQBVoWwUPZmxIKWNvQ.png" /></figure><h3>Working on Federated Learning:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*76nKcWXpMXV-z99ObR1qtQ.png" /></figure><blockquote><strong>Let’s train a basic model in a conventional manner. All our data will be aggregated into our local machine and we can use it to make updates to our model.</strong></blockquote><p>Step 1: Importing all Dependencies</p><p>Step 2: Creating a dataset and model</p><p>Step 3: Training the model</p><pre>        # 1) erase previous gradients (if they exist)<br>        # 2) make a prediction<br>        # 3) calculate how much we missed<br>        # 4) figure out which weights caused us to miss<br>        # 5) change those weights<br>        # 6) print our progress</pre><blockquote><strong>Federated Learning, however, doesn’t work this way. So, let’s modify this example to do it the Federated Learning way!</strong></blockquote><p>Step 1. create a couple of workers</p><p>Step 2. get pointers to training data on each worker</p><p>Step 3. Updated training logic to do federated learning</p><pre>        # 1) send model to correct worker<br>        # 2) train on the data located there<br>        # 3) get the model back and repeat with next worker</pre><h3>Modifying the Conventional Example with Toy Dataset:</h3><h4><strong>Step 1: Importing all Dependencies</strong></h4><pre>import syft as sy<br>hook = sy.TorchHook(torch)</pre><pre><strong># Create a couple of workers</strong><br>bob = sy.VirtualWorker(hook, id=&quot;bob&quot;)<br>alice = sy.VirtualWorker(hook, id=&quot;alice&quot;)</pre><h4>Step 2: Creating dataset and model</h4><pre><em># Toy Dataset</em><br>data = torch.tensor([[0,0],[0,1],[1,0],[1,1.]],requires_grad=True)<br>target = torch.tensor([[0],[0],[1],[1.]], requires_grad=True)</pre><pre><strong># get pointers to training data on each worker<br></strong>data_bob = data[0:2]<br>target_bob = target[0:2]<br><br>data_alice = data[2:]<br>target_alice = target[2:]<br><br><em># Creating Toy Model</em><br>model = nn.Linear(2,1)</pre><pre><strong># sending some training data to bob and alice</strong><br>data_bob = data_bob.send(bob)<br>data_alice = data_alice.send(alice)<br>target_bob = target_bob.send(bob)<br>target_alice = target_alice.send(alice)<br><br><strong># organize pointers into a list</strong><br>datasets = [(data_bob,target_bob),(data_alice,target_alice)]</pre><h4>Step 3: Training the Model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bt-E42sUzFBrz9KiN_S1aA.png" /></figure><pre>optimizer = optim.SGD(params=model.parameters(),lr=0.1)<br>for i in range(20):<br>        <br>        <strong># iterate through each worker&#39;s dataset</strong></pre><pre>        for data,target in datasets:<br>            <br>            <strong># send model to correct worker</strong><br>            model.send(data.location)<br><br>            # 1) erase previous gradients (if they exist)<br>            optimizer.zero_grad()<br><br>            # 2) make a prediction<br>            pred = model(data)<br><br>            # 3) calculate how much we missed<br>            loss = ((pred - target)**2).sum()<br><br>            # 4) figure out which weights caused us to miss<br>            loss.backward()<br><br>            # 5) change those weights<br>            optimizer.step()<br>            <br>            <strong># get the model back (with gradients)</strong><br>            model.get()<br><br>            # 6) print our progress<br>            print(loss.get()) <strong>#use .get() to get loss</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QjqPH_W7wzBkRqPXxRJxA.png" /></figure><h3>Conclusion</h3><blockquote>We now are training a conventional Deep Learning model using Federated Learning! Here, we send the model to each worker, generate a new gradient, and then bring the gradient back to our local server where we update our global model. In this process, we never request access to training data. Hence, We preserve the privacy of Bob and Alice!</blockquote><h4>References</h4><p>[1] <a href="https://federated.withgoogle.com/">Comic Pictures taken from https://federated.withgoogle.com/</a></p><p><strong>Thank You, If Found Useful Clap it! and Share it! to others in need!!</strong></p><p><a href="https://www.linkedin.com/in/garg4/">https://www.linkedin.com/in/garg4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe977cdd3c62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/the-future-of-ai-federated-learning-fe977cdd3c62">The Future of AI: Federated Learning</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Colab Notebook for Lesson 7 Federated Learning]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/google-colab-notebook-for-lesson-7-federated-learning-21d479e09961?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/21d479e09961</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[udacityfacebookscholar]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Sun, 16 Jun 2019 08:16:50 GMT</pubDate>
            <atom:updated>2019-07-17T08:49:32.552Z</atom:updated>
            <content:encoded><![CDATA[<h4>#UdacityFacebookScholar</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*Eb4YFMdn8LJhxjJCuykiLg.png" /></figure><p>Link to the Notebook:</p><p><a href="https://drive.google.com/file/d/1yKMYw9ELb2D6ncMai48o5t8p6acXRqWR/view?usp=sharing">Section_2_Federated_Learning_Archit.ipynb</a></p><p>In Lesson 7 Federated Learning we have to install PySyft into our local Environment and I see many of them getting problem in Installing the PySyft Therefore you can use this notebook prepared by me by keeping try yourself or things to do blank as given by Andrew Trask</p><p>Here are the brief steps:</p><ol><li>Download the modified Notebook from this <a href="https://drive.google.com/file/d/1yKMYw9ELb2D6ncMai48o5t8p6acXRqWR/view">link</a></li><li>Visit <a href="https://colab.research.google.com/">Google Colab</a></li><li>You will be prompted with a modal, select Upload</li><li>If modal doesn’t appear and Opens it by clicking a new Notebook, then from menu File &gt; Upload Notebook</li><li>Upload the modified notebook</li><li>Enjoy!!</li></ol><p>Hope this helps! If you have got any issues with running this notebook or installation of PySyft, then feel free to dm me or ping me on Slack for any help. My slack username is archit</p><p>Thank You!</p><p><strong>If Found Useful Clap it! and Share it! to others in need!!</strong></p><p><a href="https://www.linkedin.com/in/garg4/">https://www.linkedin.com/in/garg4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21d479e09961" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/google-colab-notebook-for-lesson-7-federated-learning-21d479e09961">Google Colab Notebook for Lesson 7 Federated Learning</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[helper.py module solution]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/helper-py-module-solution-fd0fa4700cba?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd0fa4700cba</guid>
            <category><![CDATA[udacityfacebookscholar]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Sun, 16 Jun 2019 07:14:18 GMT</pubDate>
            <atom:updated>2019-06-17T07:17:10.353Z</atom:updated>
            <content:encoded><![CDATA[<h4>#UdacityFacebookScholar</h4><p>In Lesson 4, we use our local environment to setup Jupyter notebook for the first time. At this time we have faced an issue sue to custom module helper.py, which contain many functions to help, it acts like utils module in our project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*ZkzqAOoDYTKGlXJk6MUUOw.png" /><figcaption>Error</figcaption></figure><p>So, here as the file is not available we are getting ModuleNotFoundError: No module names ‘helper’<br>So, you need to download the module using:</p><pre>!wget -c <a href="https://raw.githubusercontent.com/udacity/deep-learning-v2-pytorch/master/intro-to-pytorch/helper.py">https://raw.githubusercontent.com/udacity/deep-learning-v2-pytorch/master/intro-to-pytorch/helper.py</a> </pre><p>so, add this in a cell above import helper and run both, therefore no need to do anything else. This will download the file and place it in the current directory where the notebook is being run. And will solve all the helper module issues. <br>After that restart your runtime !!!!</p><p>Thank You!!</p><p><strong>If Found Useful Clap it! and Share it! to others in need!!</strong></p><p><a href="https://www.linkedin.com/in/garg4/">https://www.linkedin.com/in/garg4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd0fa4700cba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/helper-py-module-solution-fd0fa4700cba">helper.py module solution</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Formal Definition of Differential Privacy (UdacityFacebookScholarship Challange)]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/the-formal-definition-of-differential-privacy-udacityfacebookscholarship-challange-a344dbf4453?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a344dbf4453</guid>
            <category><![CDATA[differential-privacy]]></category>
            <category><![CDATA[udacityfacebookscholar]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Sun, 16 Jun 2019 02:46:16 GMT</pubDate>
            <atom:updated>2019-06-29T11:29:02.636Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Formal Definition of Differential Privacy</h3><h4>Explanation of Cynthia Dwork’s formula:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knX1qFBdEUaWjEu4_yREJA.png" /><figcaption>Cynthia Dwork’s Formula</figcaption></figure><h4>Terms:</h4><p><strong>M:</strong> This would be randomized algorithm i.e query(db) + noise or query(db + noise. Basically, M being the query have some sort of noise</p><p><strong>S: </strong>All potential output of M that it could predict.</p><p><strong>x:</strong> Entries in the database, i.e count how many times it was in the database.</p><p><strong>y:</strong> Entries in parallel database</p><p><strong>epsilon: </strong>The maximum distance between a query on database (x) and the same query on database (y)</p><h3>Definition:</h3><p>This definition does not create differential privacy, instead, it is a measure of how much privacy is afforded by a query M.</p><p>Specifically, it’s a comparison between running the query M on a database (x) and a parallel database (y).</p><p><strong>Parallel databases</strong> are defined to be the same as a full database (x) with one entry/person removed.</p><h3>Example:</h3><p>Thanks, Henrique Mello for such a nice example:</p><ol><li>Let’s take the sum query as an example. If we have a database with 10 entries and each one of them can be 0 or 1, then S = {0,1,2,3,4,5,6,7,8,9}.</li><li>Now let’s <strong>add some noise</strong>. Consider that each sum can be added or subtracted by 1 with 50% probability.</li><li>So, for each sum query we do, our result either goes up by 1 or goes down by 1. In that case, S = {-1,0,1,2,3,4,5,6,7,8,9,10}.</li><li>The -1 and the 10 were added to account the cases where the sum equals to 0 but the noise is -1 and when the sum equals to 9 and the noise is +1.</li><li>M(x) is the result of our query. If we take the sum with noise query above, M(x) could be any value in S, as our query will always return a value that is in it. This satisfies the part `<strong>M(x) in S</strong>`. Since the parallel database M(y) can return the same results, this also satisfies `<strong>M(y) in S</strong>`.</li><li>Now, <strong>Pr[M(x) in S]</strong> is the probability that the returned sum is M(x). In our example, let’s say that our database is [0,1,0,1,1,1,0,1,0,1]. The sum of this database can be `M(x) = 6 + 1 = 7` or `M(x) = 6–1 = 5`. as there are only two options therefore, P(Event 1)+P(Event 2)=1, since Event 1 and Event 2 are equally probable then P(Event 1)=P(Event 2)=0.5. So, for this specific query, `Pr[M(x) = 7] = 0.5` and `Pr[M(x) = 5] = 0.5`, because the value of M(x) without any noise is the same and the probability of adding or subtracting by 1 is 0.5. So either result is equally probable.</li></ol><p><strong>If Found Useful Clap it! and Share it! to others in need!!</strong></p><p><a href="https://www.linkedin.com/in/garg4/">https://www.linkedin.com/in/garg4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a344dbf4453" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/the-formal-definition-of-differential-privacy-udacityfacebookscholarship-challange-a344dbf4453">The Formal Definition of Differential Privacy (UdacityFacebookScholarship Challange)</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Private and Secure Artificial Intelligence]]></title>
            <link>https://medium.com/secure-and-private-ai-writing-challenge/introducing-private-and-secure-artificial-intelligence-7ac83ca80cfa?source=rss-4393e5f0c5d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ac83ca80cfa</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[differential-privacy]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[udacityfacebookscholar]]></category>
            <dc:creator><![CDATA[Archit]]></dc:creator>
            <pubDate>Thu, 13 Jun 2019 11:02:49 GMT</pubDate>
            <atom:updated>2019-06-17T07:16:08.426Z</atom:updated>
            <content:encoded><![CDATA[<h4>{Warning: After reading you will change your career path}</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*50myAoeml5FBjNosQH4hgA.jpeg" /></figure><h3>Introduction:</h3><blockquote>Differential Privacy is about ensuring that when our neural networks are learning from sensitive data, that they’re only learning what they’re supposed to learn from the data without accidentally learning what they’re not supposed to learn from the data.</blockquote><p>The term ‘Differential’ in Differential Privacy refers to variation due to the amount of privacy that the query provides and the loss in accuracy of the distribution like Adding noise provides privacy but reduced accuracy.</p><h4>Foundational Principles of Differential Privacy</h4><ol><li>How noise is applied?</li><li>How we define privacy?</li></ol><h3>What is Differential Privacy?</h3><p>The general goal of differential privacy is to ensure that different kind of statistical analysis doesn’t compromise privacy and privacy is preserved if, after the analysis, the analyzer doesn’t know anything about the features in data-set, that means Information which has been made public elsewhere isn’t harmful to an individual.</p><blockquote><strong>Robust definition of privacy proposed by Cynthia Dwork, Algorithmic Foundations:</strong></blockquote><blockquote>“Differential Privacy” describes a promise, made by a data holder, or curator, to a data subject, and the promise is like this: “You will not be affected, adversely or otherwise, by allowing your data to be used in any study or analysis, no matter what other studies, data sets, or information sources, are available.”</blockquote><p>On Considering a person database, to define privacy in the context of this, we’re performing some query against the database and if we remove a person from the database and the query doesn’t change then that person’s privacy would be fully protected. This means we are removing a person from the database and query doesn’t change then it means that person wasn’t leaking any statistical information into the output of the query. To give you more intuition about this let us see in a python code:</p><p>Note: <strong>“parallel databases” </strong>are simply databases with one entry removed, like in the case below we are creating n parallel database with 1 entry removed in each, starting from first like in the first pdb, the first entry is removed, similarly in the second pdb, the second entry is removed.</p><p><em>Note: Checkout Comments in the code for Explanation</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f3e15a56a2c4e24fab936969bfc3567/href">https://medium.com/media/7f3e15a56a2c4e24fab936969bfc3567/href</a></iframe><h3>Evaluating The Privacy of a function</h3><p>Now let us see how to query this database and then measure the privacy of that query for this we have to compare the output of query on the entire database with the output of the query on each of the parallel databases. Hence, in this way we see how query changes on removing a person from the database. If the query doesn’t change this means the removed person didn’t leak any private information</p><p>For this, we have to check out the difference in the output of the query relative to when we would query the entire database for all parallel database and this difference is helping to evaluate <strong>sensitivity</strong>.</p><p><strong>Sensitivity or L1 sensitivity</strong> help to compare how different queries do or do not leak information and it is the maximum change in the query when we are removing a person from the database</p><p>Now to Evaluate the privacy of a function we have to follow the following steps:</p><ol><li>Create parallel databases.</li><li>Define a function which queries a database.</li><li>Now calculate the sensitivity.</li></ol><p>The main strategy that we’re going to take to protect the individual’s privacy is one of noise. which means we are adding random noise to the database and to the queries in the databases in order to protect people’s privacy.</p><h3>Introducing Local and Global Differential Privacy</h3><blockquote><strong>Local Differential Privacy</strong> adds noise to function inputs. In this case, each individual add noise to their data before putting it into the database. So, everything that enters into the database is already noised. In this setting, users are most protected as they do not have to trust the database owner to use their data</blockquote><blockquote><strong>Global Differential Privacy </strong>adds noise to the output of the query on the database. This means that the database itself contains all the private information and that it’s only the interface to the data which adds the noise necessary to protect each individual’s privacy.</blockquote><p>If the database operator is trustworthy that means the <strong>database owner</strong>(<em>Trusted curator</em>) should add noise properly, the only difference is that global differential privacy leads to more accurate result with the same level of privacy protection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*vlSX7Uzsfq0dzfXMJlsigg.jpeg" /></figure><h4>References</h4><p>[1] Aaron Roth and Cynthia Dwork<a href="https://www.cis.upenn.edu/~aaroth/Papers/privacybook.pdf">, <strong>Algorithmic Foundations of Differential Privacy</strong></a> (2014), Foundations and Trends R in Theoretical Computer Science Vol. 9, Nos. 3–4 (2014) 211–407</p><p><strong>If Found Useful Clap it! and Share it! to others in need!!</strong></p><p><a href="https://www.linkedin.com/in/garg4/">https://www.linkedin.com/in/garg4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ac83ca80cfa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/secure-and-private-ai-writing-challenge/introducing-private-and-secure-artificial-intelligence-7ac83ca80cfa">Introducing Private and Secure Artificial Intelligence</a> was originally published in <a href="https://medium.com/secure-and-private-ai-writing-challenge">Secure and Private AI Writing Challenge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>