<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Future - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Future - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 30 May 2026 22:26:26 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/future/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ An introduction to explainable AI, and why we need it ]]>
                </title>
                <description>
                    <![CDATA[ By Patrick Ferris Neural networks (and all of their subtypes) are increasingly being used to build programs that can predict and classify in a myriad of different settings. Examples include machine translation using recurrent neural networks, and ima... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/an-introduction-to-explainable-ai-and-why-we-need-it-a326417dd000/</link>
                <guid isPermaLink="false">66c3441e790a62b5fbf7b877</guid>
                
                    <category>
                        <![CDATA[ Artificial Intelligence ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Data Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Future ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 27 Aug 2018 20:38:58 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*yT52DLV4NWUp6KFN1S2Qxg.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Patrick Ferris</p>
<p>Neural networks (and all of their subtypes) are increasingly being used to build programs that can predict and classify in a myriad of different settings.</p>
<p>Examples include <a target="_blank" href="https://arxiv.org/pdf/1806.08730.pdf">machine translation</a> using recurrent neural networks, and <a target="_blank" href="https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf">image classification</a> using a convolutional neural network. Research published by Google DeepMind has sparked interest in <a target="_blank" href="https://arxiv.org/pdf/1312.5602.pdf">reinforcement learning</a>.</p>
<p>All of these approaches have advanced many fields and produced usable models that can improve productivity and efficiency.</p>
<p>However, <strong>we don’t really know how they work</strong>.</p>
<p>I was fortunate enough to attend the <a target="_blank" href="http://www.kdd.org/kdd2018/">Knowledge Discovery and Data Mining</a> (KDD) conference this year. Of the talks I went to, there were two main areas of research that seem to be on a lot of people’s minds:</p>
<ul>
<li>Firstly, finding a meaningful representation of graph structures to feed into neural networks. <a target="_blank" href="https://ai.google/research/people/OriolVinyals">Oriol Vinyals</a> from DeepMind gave a talk about their <a target="_blank" href="https://arxiv.org/pdf/1704.01212.pdf">Message Passing Neural Networks</a>.</li>
<li>The second area, and the focus of this article, are explainable AI models. As we generate newer and more innovative applications for neural networks, the question of ‘How do they work?’ becomes more and more important.</li>
</ul>
<h4 id="heading-why-the-need-for-explainable-models">Why the need for Explainable Models?</h4>
<p>Neural Networks are not infallible.</p>
<p>Besides the problems of overfitting and underfitting that we’ve developed many tools (like Dropout or increasing the data size) to counteract, neural networks operate in an opaque way.</p>
<p>We don’t really know why they make the choices they do. As models become more complex, the task of producing an interpretable version of the model becomes more difficult.</p>
<p>Take, for example, the <a target="_blank" href="https://arxiv.org/pdf/1710.08864.pdf">one pixel attack</a> (see here for a great <a target="_blank" href="https://www.youtube.com/watch?v=SA4YEAWVpbk">video</a> on the paper). This is carried out by using a sophisticated approach which analyzes the CNNs and applies differential evolution (a member of the evolutionary class of algorithms).</p>
<p>Unlike other optimisation strategies which restrict the objective function to be differentiable, this approach uses an iterative evolutionary algorithm to produce better solutions. Specifically, for this one pixel attack, the only information required was the probabilities of the class labels.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/xh9yxzzOW8B7zibKo1JbjkaWOacnxx8mK0kl" alt="Image" width="688" height="952" loading="lazy">
_From [One pixel attack for fooling deep neural networks](https://arxiv.org/pdf/1710.08864.pdf" rel="noopener" target="<em>blank" title=") by Jiawei Su et al.</em></p>
<p>The relative ease of fooling these neural networks is worrying. Beyond this lies a more systemic problem: trusting a neural network.</p>
<p>The best example of this is in the medical domain. Say you are building a neural network (or any black-box model) to help predict heart disease given a patient’s records.</p>
<p>When you train and test your model, you get a good accuracy and a convincing positive predictive value. You bring it to a clinician and they agree it seems to be a powerful model.</p>
<p>But they will be hesitant to use it because you (or the model) cannot answer the simple question: “Why did you predict this person as more likely to develop heart disease?”</p>
<p>This lack of transparency is a problem for the clinician who wants to understand the way the model works to help them improve their service. It is also a problem for the patient who wants a concrete reason for this prediction.</p>
<p>Ethically, is it right to tell a patient that they have a higher probability of a disease if your only reasoning is that “the black-box told me so”? Health care is as much about science as it is about empathy for the patient.</p>
<p>The field of explainable AI has grown in recent years, and this trend looks set to continue.</p>
<p>What follows are some of the interesting and innovative avenues researchers and machine learning experts are exploring in their search for models which not only perform well, but can tell you why they make the choices they do.</p>
<h4 id="heading-reversed-time-attention-model-retain">Reversed Time Attention Model (RETAIN)</h4>
<p>The RETAIN model was developed at Georgia Institute of Technology by <a target="_blank" href="https://arxiv.org/pdf/1608.05745.pdf">Edward Choi et al.</a> It was introduced to help doctors understand why a model was predicting patients to be at risk of heart failure.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ezTATi55cPwwF3y4ntYTSiqV0JudbaOVVowa" alt="Image" width="752" height="775" loading="lazy">
<em>The RETAIN Recurrent Neural Network Model makes use of Attention Mechanisms to improve interpretability</em></p>
<p>The idea is, given a patients’ hospital visits records which also contain the events of the visit, they could predict the risk of heart failure.</p>
<p>The researchers split the input into two recurrent neural networks. This let them use the <a target="_blank" href="http://www.wildml.com/2016/01/attention-and-memory-in-deep-learning-and-nlp/">attention mechanism</a> on each to understand what the neural network was focusing on.</p>
<p>Once trained, the model could predict a patient’s risk. But it could also make use of the alpha and beta parameters to output which hospital visits (and which events within a visit) influenced its choice.</p>
<h4 id="heading-local-interpretable-model-agnostic-explanations-lime">Local Interpretable Model-Agnostic Explanations (LIME)</h4>
<p>Another approach that has become fairly common in use is <a target="_blank" href="https://arxiv.org/pdf/1602.04938.pdf">LIME</a>.</p>
<p>This is a post-hoc model — it provides an explanation of a decision after it has been made. This means it isn’t a pure ‘glass-box’, transparent model (like decision trees) from start to finish.</p>
<p>One of the main strengths of this approach is that it’s model agnostic. It can be applied to any model in order to produce explanations for its predictions.</p>
<p>The key concept underlying this approach is perturbing the inputs and watching how doing so affects the model’s outputs. This lets us build up a picture of which inputs the model is focusing on and using to make its predictions.</p>
<p>For instance, imagine some kind of CNN for image classification. There are four main steps to using the LIME model to produce an explanation:</p>
<ul>
<li>Start with a normal image and use the black-box model to produce a probability distribution over the classes.</li>
<li>Then perturb the input in some way. For images, this could be hiding pixels by coloring them grey. Now run these through the black-box model to see the how the probabilities for the class it originally predicted changed.</li>
<li>Use an interpretable (usually linear) model like a decision tree on this dataset of perturbations and probabilities to extract the key features which explain the changes. The model is locally weighted — meaning that we care more about the perturbations that are most similar to the original image we were using.</li>
<li>Output the features (in our case, pixels) with the greatest weights as our explanation.</li>
</ul>
<h4 id="heading-layer-wise-relevance-propagation-lrp">Layer-wise Relevance Propagation (LRP)</h4>
<p>This <a target="_blank" href="https://arxiv.org/pdf/1604.00825.pdf">approach</a> uses the idea of relevance redistribution and conservation.</p>
<p>We start with an input (say, an image) and its probability of a classification. Then, work backwards to redistribute this to all of the inputs (in this case pixels).</p>
<p>The redistribution process is fairly simple from layer to layer.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/f5l2bqv5EmPztk1i0dyRMBRdj1AK5HdPMNX8" alt="Image" width="800" height="164" loading="lazy">
<em>Don’t be scared — this equation is just weighting relevances based on neuron activation and weight connnection</em></p>
<p>In the above equation, each term represents the following ideas:</p>
<ul>
<li><code>x_j</code> — the activation value for neuron <em>j</em> in layer <em>l</em></li>
<li><code>w_j,k</code> — the weighting of the connection between neuron <em>j</em> in layer <em>l</em> and neuron <em>k</em> in layer <em>l + 1</em></li>
<li><code>R_j</code> — Relevance scores for each neuron in layer <em>l</em></li>
<li><code>R_k</code> — Relevance scores for each neuron in layer <em>l+1</em></li>
</ul>
<p>The epsilon is just a small value to prevent dividing by zero.</p>
<p>As you can see, we can work our way backwards to determine the relevance of individual inputs. Further, we can sort these in order of relevance. This lets us extract a meaningful subset of inputs as our most useful or powerful in making a prediction.</p>
<h4 id="heading-what-next">What next?</h4>
<p>The above methods for producing explainable models are by no means exhaustive. They are a sample of some of the approaches researchers have tried using to produce interpretable predictions from black-box models.</p>
<p>Hopefully this post also sheds some light onto why it is such an important area of research. We need to continue researching these methods, and develop new ones, in order for machine learning to benefit as many fields as possible — in a safe and trustworthy fashion.</p>
<p>If you find yourself wanting more papers and areas to read about, try some of the following.</p>
<ul>
<li><a target="_blank" href="http://proceedings.mlr.press/v80/kim18d/kim18d.pdf">DeepMind</a>’s research on Concept Activation Vectors, as well as the <a target="_blank" href="http://s.interpretable.ml/nips_interpretable_ml_2017_victoria_Krakovna.pdf">slides</a> from Victoria Krakovna’s talk at Neural Information Processing Systems (NIPS) conference.</li>
<li>A <a target="_blank" href="https://arxiv.org/pdf/1711.07373.pdf">paper</a> by Dung Huk Park et al. on datasets for measuring explainable models.</li>
<li><a target="_blank" href="https://www.seas.harvard.edu/directory/finale">Finale Doshi-Velez</a> and <a target="_blank" href="https://beenkim.github.io/">Been Kim</a>’s <a target="_blank" href="https://arxiv.org/pdf/1702.08608.pdf">paper</a> on the field in general</li>
</ul>
<p>Artificial intelligence should not become a powerful deity which we follow blindly. But neither should we forget about it and the beneficial insight it can have. Ideally, we will build flexible and interpretable models that can work in collaboration with experts and their domain knowledge to provide a brighter future for everyone.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How we recreated Amazon Go in 36 hours ]]>
                </title>
                <description>
                    <![CDATA[ By Subhan Nadeem My colleagues and I wanted to create something that would make people go “wow” at our latest hackathon. Because imitation is the sincerest form of flattery and IoT is incredibly fun to work with, we decided to create our own version ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-we-recreated-amazon-go-in-36-hours-e32a4101d5f0/</link>
                <guid isPermaLink="false">66c3568b1efc805979ae9f68</guid>
                
                    <category>
                        <![CDATA[ Android ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Future ]]>
                    </category>
                
                    <category>
                        <![CDATA[ iot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 04 Jan 2018 20:57:41 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*FR4dUJjxG1v5cV66." medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Subhan Nadeem</p>
<p>My colleagues and I wanted to create something that would make people go “wow” at our latest hackathon.</p>
<p>Because imitation is the sincerest form of flattery and IoT is incredibly fun to work with, we decided to create our own version of Amazon Go.</p>
<p>Before I explain what it took to make this, here’s the 3 minute demo of what we built!</p>
<p>There were four of us. <a target="_blank" href="https://www.freecodecamp.org/news/how-we-recreated-amazon-go-in-36-hours-e32a4101d5f0/undefined">Ruslan</a>, a great full-stack developer who had experience working with Python. John, an amazing iOS developer. Soheil, another great full-stack developer who had experience with Raspberry Pi. And finally, there was me, on the tail end of an Android developer internship.</p>
<p>I quickly realized that there were a lot of moving parts to this project. Amazon Go works on the basis of real-time proximity sensors in conjunction with a real-time database of customers and their carts.</p>
<p>We also wanted to take things a step further and make the entry/exit experience seamless. We wanted to let people enter and exit the store without needing to tap their phones.</p>
<p>In order to engage users as a consumer-facing product, our app would need a well-crafted user interface, like the real Amazon Go.</p>
<p>On the day before the hackathon, I put together a pseudo-design doc outlining what we needed to do within the 36 hour deadline. I incorporated the strengths of our team and the equipment at hand. The full hastily assembled design doc can be seen below.</p>
<p>There were six main components to EZShop, our version of Amazon Go.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*eTzUuujmvx3U3foEb_lNog.png" alt="Image" width="800" height="591" loading="lazy">
<em>A quick diagram I whipped up visualizing the components of this project</em></p>
<h3 id="heading-the-kairos-facial-recognition-api">The Kairos Facial Recognition API</h3>
<p>The <a target="_blank" href="https://www.kairos.com/">Kairos facial recognition API</a> was a fundamental component for us. It abstracted the ability to identify and store unique faces. It had two APIs that we used: <code>/enroll</code> and <code>/verify</code>.</p>
<p><code>/enroll</code> is described as:</p>
<blockquote>
<p>Takes a photo, finds the faces within it, and stores the faces into a gallery you create.</p>
</blockquote>
<p>We enrolled all new customers into a single “EZShop” gallery. A unique <code>face_id</code> attribute would be returned and stored with the customer’s registered name in our real-time database.</p>
<p>When we wanted to verify a potential customer’s image, we would POST it to the <code>/verify</code> endpoint. This would return the <code>face_id</code> with the highest probability of a match.</p>
<p>In a real-world implementation, it probably would have been a better idea to use a natively implemented facial recognition pipeline with TensorFlow instead of a network API. But given our time constraints, the API served us very well.</p>
<h3 id="heading-the-realtime-firebase-database"><strong>The Realtime Firebase Database</strong></h3>
<p>The Firebase database was another fundamental piece to our puzzle. Every other component interacted with it in real time. Firebase allows customized change listeners to be created upon any data within the database. That feature, coupled with the easy set-up process, made it a no brainer to use.</p>
<p>The schema was incredibly simple. The database stored an array of items and an array of users. The following is an example JSON skeleton of our database:</p>
<pre><code>{  <span class="hljs-string">"items"</span>: [    {      <span class="hljs-string">"item_id"</span>: <span class="hljs-number">1</span>,      <span class="hljs-string">"item_name"</span>: <span class="hljs-string">"Soylent"</span>,      <span class="hljs-string">"item_stock"</span>: <span class="hljs-number">1</span>,      <span class="hljs-string">"price"</span>: <span class="hljs-number">10</span>    }  ],  <span class="hljs-string">"users"</span>: [    {      <span class="hljs-string">"face_id"</span>: <span class="hljs-number">1</span>,      <span class="hljs-string">"name"</span>: <span class="hljs-string">"Subhan Nadeem"</span>,      <span class="hljs-string">"in_store"</span>: <span class="hljs-literal">false</span>,      <span class="hljs-string">"cart"</span>: [        <span class="hljs-number">1</span>      ]    }  ]}
</code></pre><p>New users would be added to the array of users in our database after registering with the Kairos API. Upon entry or exit, the customer’s boolean <code>in_store</code> attribute would be updated, which would be reflected in the manager and personal app UIs.</p>
<p>Customers picking up an item would result in an updated item stock. Upon recognizing which customer picked up what item, the item’s ID would be added to the customer’s <code>cart</code> array.</p>
<p>I had planned for a cloud-hosted Node/Flask server that would route all activity from one device to another, but the team decided that it was much more efficient (although more hacky) for everybody to work directly upon the Firebase database.</p>
<h3 id="heading-the-manager-and-personal-customer-apps">The Manager and Personal Customer Apps</h3>
<p>John, being the iOS wizard that he is, finished these applications in the first 12 hours of the hackathon! He really excelled at designing user-friendly and accessible apps.</p>
<h4 id="heading-the-manager-app"><strong>The Manager App</strong></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*-mxfk-c6IMhkviUW-91isw.png" alt="Image" width="800" height="600" loading="lazy"></p>
<p>This iPad application registered new customers into our Kairos API and Firebase database. It also displayed all customers in the store and the inventory of store items. The ability to interact directly with the Firebase database and observe changes made to it (e.g. when a customer’s <code>in_store</code> attribute changes from <code>true</code> to <code>false</code>) made this a relatively painless process. The app was a great customer-facing addition to our demo.</p>
<h4 id="heading-the-personal-shopping-app">The Personal Shopping App</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*3kMsmAdlwvkbb7zfvppvsA.png" alt="Image" width="800" height="1422" loading="lazy"></p>
<p>Once the customer was registered, we would hand a phone with this app installed to the customer. They would log in with their face (Kairos would recognize and authenticate). Any updates to their cart would be shown on the phone instantly. Upon exiting the store, the customer would also receive a push notification on this phone stating the total amount they spent.</p>
<h3 id="heading-the-item-rack-sensors-and-camera">The Item Rack, Sensors, and Camera</h3>
<p>Soheil and Ruslan worked tirelessly for hours to perfect the design of the item shelf apparatus and the underlying Pi Python scripts.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*x8ClNraW0zWDkr4lMWcpIw.png" alt="Image" width="800" height="928" loading="lazy">
<em>The item rack apparatus. Three items positioned in rows, a tower for the security camera, and ultrasonic sensors positioned at the rear</em></p>
<p>There were three items positioned in rows. At the end of two rows, an ultrasonic proximity sensor was attached. We only had two ultrasonic sensors, so the third row had a light sensor under the items, which did not work as seamlessly. The ultrasonic sensors were connected to the Raspberry Pi that processed the readings of the distance from the next closest object via simple Python scripts (either the closest item or the end of the rack). The light sensor detected a “dark” or “light” state (dark if the item was on top of it, light otherwise).</p>
<p>When an item was lifted, the sensor’s reading would change and trigger an update to the item’s stock in the database. The camera (Android phone) positioned at the top of the tower would detect this change and attempt to recognize the customer picking up the item. The item would then instantly be added to that customer’s cart.</p>
<h3 id="heading-entrance-and-exit-cameras">Entrance and Exit Cameras</h3>
<p>I opted to use Android phones as our facial recognition cameras, due to my relative expertise with Android and the easy coupling phones provide when taking images and processing them.</p>
<p>The phones were rigged on both sides of a camera tripod, one side at the store’s entrance, and the other at the store exit.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*k-WY9QPGAuQocOBCjHhrWw.png" alt="Image" width="720" height="858" loading="lazy">
<em>A camera tripod, two phones, and lots of tape</em></p>
<p>Google has an incredibly useful <a target="_blank" href="https://developers.google.com/vision/">Face API</a> that implements a native pipeline for detecting human faces and other related useful attributes. I used this API to handle the heavy lifting for facial recognition.</p>
<p>In particular, the API provided an approximate distance of a detected face from the camera. Once a customer’s face was within a close distance, I would take a snapshot of the customer, verify it against the Kairos API to ensure the customer existed in our database, and then update the Firebase database with the customer’s in-store status.</p>
<p>I also added a personalized text-to-speech greeting upon recognizing the customer. That really ended up wowing everybody who used it.</p>
<p>The result of this implementation can be seen <a target="_blank" href="https://www.youtube.com/watch?v=XgtPey1TSIE">here</a>:</p>
<p>Once the customer left the store, the exit-detection state of the Android application was responsible for retrieving the items the customer picked up from the database, calculating the total amount the customer spent, and then sending a push notification to the customer’s personal app via Firebase Cloud Messaging.</p>
<p>Of the 36 hours, we slept for about 6. We spent our entire time confined to a classroom in the middle of downtown Toronto. There were countless frustrating bugs and implementation roadblocks we had to overcome. There were some bugs in our demo that you probably noticed, such as the cameras failing to recognize several people in the same shot.</p>
<p>We would have also liked to implement additional features, such as detecting customers putting items back on the rack and adding a wider variety of items.</p>
<p>Our project ended up winning first place at the hackathon. We set up an interactive booth for an hour (the Chipotle box castle that can be seen in the title picture) and had over a hundred people walk through our shop. People would sign up with a picture, log into the shopping app, walk into the store, pick up an item, walk out, and get notified of their bill instantly. No cashiers, no lines, no receipts, and a very enjoyable user experience.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*_J9ngCwl2XZLdLgHZeVJuA.jpeg" alt="Image" width="800" height="533" loading="lazy">
<em>Walking a customer through our shop</em></p>
<p>I was proud of the way our team played to each individual’s strengths and created a well put-together full-stack IoT project in the span of a few hours. It was an incredibly rewarding feeling for everybody, and it’s something I hope to replicate in my career in the future.</p>
<p>I hope this gave you some insight into what goes on behind the scenes of a large, rapidly prototyped, and hacky hackathon project such as EZShop.</p>
<p><strong>Follow me on <a target="_blank" href="https://twitter.com/SubhanNadeem19">Twitter</a> and <a target="_blank" href="https://medium.com/@subhan_nadeem">Medium</a> if you’re interested in more in-depth and informative write-ups like this one! I’m always opening to connecting with and learning from other software developers.</strong></p>
<p><strong>The project is open-source and can be found on Github <a target="_blank" href="https://github.com/subhan-nadeem/EZShop">here</a>. Be warned, hackathon code isn’t pretty!</strong></p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
