<?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 Saeed Tamboli on Medium]]></title>
        <description><![CDATA[Stories by Saeed Tamboli on Medium]]></description>
        <link>https://medium.com/@saeed_tamboli?source=rss-f422f50126ff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SZQKMHGIvVVi_q1b</url>
            <title>Stories by Saeed Tamboli on Medium</title>
            <link>https://medium.com/@saeed_tamboli?source=rss-f422f50126ff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:23:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saeed_tamboli/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[Has it Gone Bad or Not?]]></title>
            <link>https://medium.com/@saeed_tamboli/has-it-gone-bad-or-not-77714ed9237c?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/77714ed9237c</guid>
            <category><![CDATA[food-waste]]></category>
            <category><![CDATA[expiration-date]]></category>
            <category><![CDATA[nanotechnology]]></category>
            <category><![CDATA[food-waste-solution]]></category>
            <category><![CDATA[food-science]]></category>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 01:36:38 GMT</pubDate>
            <atom:updated>2023-03-26T19:45:04.178Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is it Spoiled?</h3><h4>How material science can help us stop guessing if our meat has gone bad</h4><p>People are obsessed with food. My personal favorite is a chicken sandwich. But here in America, we seem to have an obsession with throwing food away. In fact, <strong>40% of all food produced in America is thrown away</strong>. This all is happening while people are going hungry, with 1 in 10 people within America being food insecure. It just seems so careless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*HVMmFbYSzD-CbDbE" /></figure><p>Throwing away food also has a massive impact on the environment, with 11% of all greenhouse gasses being produced from agriculture. Even discarding food is harmful to the environment, with food landfills producing enormous amounts of methane. They have the same impact on the environment as 42 coal-fired power plants.</p><p>One of the main root causes of food waste is consumers. Two-thirds of food waste comes from consumers, and <strong>one of the major factors of consumer food waste is confusing and incorrect expiration date labels</strong> such as “sell by”, “best by”, “packed on”, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_TZib2PjD3UGYRS6aEuIA.png" /></figure><p>The biggest problem is that they aren’t what the consumer believes them to be. For example, when a consumer sees the label “best by 11/22” or “sell by 11/22,” they might think that date is telling them when to throw it out. However, they aren’t meant for that purpose. Best by is used to reference when the food is at its peak, and sell by is for the store to tell them when to change inventory. There are just so many different types of labels, all with different meanings. Within Walmart alone, they found that there were 42 different types of expiration date labels. Not only are the date labels confusing most of the time, but they are also incorrect since companies purposefully undershoot the date to avoid legal trouble. This means even with foods with the “use by” label, they are still throwing out food that could have been safe to consume.</p><blockquote><strong>TLDR:</strong><em> Expriation date labels are inaccurate and confusing which leads to perfeclty good food being thrown away</em></blockquote><p>Using material science, however, we are able to solve this problem by creating a more clear and more accurate expiration date label.</p><h4>What is the cause for such mediocre expiration date labels?</h4><p>If any other technology was as inefficient as expiration date labels, then we would have changed it already. But some underlying forces lead to us having such inadequate labels.</p><p>One of the root causes of consumers being confused about expiration date labels is that there isn’t much of a drive for change. Companies don’t have the motivation to solve this problem since they only seem to benefit from the confusion. This is because if the consumer consumes the food by that time, then they have the best experience possible OR if it’s past the date, they throw it out and are inclined to re-purchase the product. So for companies <strong>due to financial reasons, there has been no push to standardize the label part of the expiration date (i.e., sell by, use by, best by).</strong></p><p>Another root cause of why it has yet to be solved is that it’s hard to standardize the process of determining the expiration date. This is due to many different factors that play into determining that date. As a result, coming up with a standardized process would be difficult and lead to inaccurate results.</p><p>You might ask, why do we need a standardized process in the first place? This is because we don’t want the incorrect date on the label since current businesses are undershooting the dates in order to avoid legal trouble witch contributes to the problem of throwing away perfectly good food.</p><p>If you want to see a full root cause analysis of the problem, look here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.figma.com%2Fembed%3Fembed_host%3Doembed%26url%3Dhttps%3A%2F%2Fwww.figma.com%2Ffile%2F34VftQaiJeRMmUpitR9bSG%2FRoot-Cause%253A-5-Whys%3Fnode-id%3D0%253A1%26t%3DYXdVUJcrEZxnnU6t-0&amp;display_name=FigJam&amp;url=https%3A%2F%2Fwww.figma.com%2Ffile%2F34VftQaiJeRMmUpitR9bSG%2FRoot-Cause%253A-5-Whys%3Fnode-id%3D0%253A1%26t%3DYXdVUJcrEZxnnU6t-0&amp;image=https%3A%2F%2Fapi-cdn.figma.com%2Fresize%2Fthumbnails%2F54b0555d-9384-4e44-919f-44489d20810e%3Fheight%3D291%26bucket%3Dfigma-alpha&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=figma" width="800" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/c32315ddf4ce7bc5974aed6994cef54c/href">https://medium.com/media/c32315ddf4ce7bc5974aed6994cef54c/href</a></iframe><p>So it seems that the solution to the problem has to be a standard, accurate, and simple-to-understand expiration date label. And t he <strong>current paper expiration date labels just don’t cut it</strong>. So we can reivent it by developing a label that can adapt to its surroundings and communicate it simply to the consumer.</p><h3>Solutions</h3><p>Many different solutions have been tried out in the past with varying levels of success; some even made it to the commercial market. However, none of them really took off for reasons I will explain later in the article.</p><p>Here is a quick table of contents of solutions I will cover:</p><ul><li>Biosensors</li><li>RFID sensors</li><li>Colorimetric Gas Sensors</li></ul><h4>Biosensors</h4><p>Biosensors are sensors that measure and detect certain biomarkers and convert them into electrical signals. One example of a biosensor is a glucometer. There are 3 parts to the biosensor: analyte, sensing element, and transducing element. This sensing element could be an enzyme, antibodies, nucleic acids, DNA, etc. This then reacts with the analyte. This is the biomarker we are looking for. These biomarkers could be certain chemicals, cells, insulin, etc. When the analyte and receptor come together, a reaction happens. This, in turn, creates a chemical or physical change which is then detected by the transducing element and converted into an electrical signal.</p><p>Now that you know what biosensors are and how they work let us now look at an application of them. In 2012 a couple of researchers from Canada were able to create a biosensor that was formed on organic film (graphene-modified screen-printed electrode), which was able to b-lactoglobulin, which is a protein within the link that can cause food allergies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17jxo6pDny4DMuXzPdQlng.png" /></figure><p>However, it comes with several challenges.</p><ol><li>Stability: Biosensors must be able to maintain their sensitivity and selectivity over time in order to provide reliable and accurate results. This can be challenging, as the biological recognition elements used in biosensors are often sensitive to factors such as temperature, pH, and humidity. Especially as the conditions of food transportation are fluctuating constantly.</li><li>Interfering substances: Biosensors must be able to distinguish the target molecule from other substances that may be present in the sample in order to provide accurate results. This can be difficult, as many substances can interfere with the binding of the recognition element to the target molecule.</li><li>Cost and complexity: Biosensors are often more complex and expensive than other types of sensors, which can limit their use in some applications. So in a case where we need scalability, biosensors with current technology cannot meet the challenge.</li><li>Reaction time: Biosensors must be able to detect the biomarkers in a timely fashion. However, it’s difficult to make a sensor that is able to be accurate along with being able to react fast.</li><li>Detection Limit: Biosensors must, in this case, need to produce a binary result: spoiled or not spoiled. However, it&#39;s difficult to make a sensor while keeping its sensitivity and reliability.</li></ol><h4>RFID sensors</h4><p>Radio-frequency identification (RFID) is a technology that uses electromagnetic fields to transport data. One example of this in our daily lives is when you use touch to pay on your credit card or your phone. Researchers at MIT have designed a solution to make RFID chips that are able to detect when food has gone bad. This is done through the process of weak coupling. These sensors send out electromagnetic waves, which are then distorted by the molecules and ions of the contents in the container, thus causing changes in the electromagnetic waves.</p><blockquote>“A simple example of feature distortion is with a container of air versus water. If a container is empty, the RFID will always respond at around 950 megahertz. If it’s filled with water, the water absorbs some of the frequency, and its main response is around only 720 megahertz.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wpI-ZBHLAsGXKWHKPAr1pA.png" /><figcaption>Note: This isn’t the actual product. It is just an example of how it might look when implemented.</figcaption></figure><p>Then they use machine learning which then can associate certain frequencies with spoilage. This technology has only been used to detect fake baby powder and alcohol, which it did with 96% accuracy. So it seems to remain whether these tags can translate over to food spoilage, which the authors of the paper state could be a potential solution.</p><p>The main problem with this is that they cannot communicate the results with the consumer effectively. Since they produce an electrical signal which would require a device such as a computer or a phone to analyze. While this might seem convenient, it is very improbable for us to scale this up. Since those without access to an electronic device are left out. This logic applies to any solution which involves an external electronic device.</p><h4>Colorimetric Gas Sensors</h4><p>Colorimetric sensors are sensors that change color when exposed to certain stimuli. Colorimetric gas sensors are sensors that change color when exposed to certain gasses. These gas sensors can vary from being electrical based or having a polymer dye.</p><p>These gas sensors can also use nanotechnology. Some examples of materials are carbon nanotubes, Tin oxide, and gold.</p><p>These sensors, in my opinion, have the most potential. If we are able to find a simple polymer such as polyaniline and modify it to meet our needs, then we have a solution that could be implemented within the next couple of years. Another method to make these sensors is with nanotechnology. However, this would be more of a challenge as it is an emerging field. But it doesn’t have the same fundamental flaws that biosensors have so with time this could become a viable solution. Nanotechnogoly also has it own perks, shown in early stages of research, such as being fast reacting and small.</p><p>These nanosensors consit of two basic components: receptor and transducer. The receptor can be an organic or inorganic substance that interacts with a selected analyte, and the transducer transforms the reaction into a measurable signal such as electrical, electrochemical, or optical signals. In this case it would be an optical signal, a color change.</p><p>By employing colorimetric sensors into this solution makes it feasible as they are easy for the consumer to read the results. <strong>If the sensor detects gasses that indicate spoilage, it can change color, which can alert the consumer very easily.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7sVVwJn2e0rG-AHotXEUMQ.png" /><figcaption>Mockup by Author</figcaption></figure><p>However, what gasses should we detect? Additionally, is detecting gasses the best way to detect meat spoilage? All of this I will answer in the next section.</p><blockquote><strong><em>Side Tangent: </em></strong><em>The reason why I focused on meat is because it was easier to detect since they all produce the same gasses which indicate spoilage and they are the most environmentally destructive food we produce.</em></blockquote><h3>Has it gone bad?</h3><p>Most of us probably ask ourselves that question when it comes to meat. It&#39;s really hard to tell, is the slime because of bacteria or water, is the smell because of the meat or me?</p><p>Additionally, if we are able to cut down on throwing away perfectly good meat, it would have a massive impact on the environment since meat is the most environmentally consequential thing we eat.</p><p>So how can we tell, scientifically, if the meat has gone bad? Here are some indicators we could use:</p><ol><li>pH</li><li>Humidity/Temperature</li><li>Volatile Organic Compunds (VOCs)</li></ol><h4>pH</h4><p>In scientific research, this is one of the most popular indicators to use for spoilage detection. This is because there are already commercially available pH dyes that change color when exposed to certain gasses. Along with the fact that in certain pH environments bacteria are able to grow rapidly. However this is an oversight, <strong>just becuase they are able to grow doesn’t mean they have grown yet or are even present.</strong></p><p>Addiotnally, this indicator is only useful in milk. The gasses that meat produces aren’t always super acidic or basic, such as ethanol. So it would be hard to detect those gasses that indicate spoilage just based on thier pH alone.</p><p>It also has a relatively low correlation with microbial counts compared to VOCs. Meaning that just because the pH changes doesn’t necessarily mean that there are more or fewer bacteria that can make you sick.</p><blockquote>“who observed a change in pH over the storage period, but its correlation with microbial counts was relatively low compared with that of other indicators such as VBN or TBA.” — <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6859128/#!po=10.0000">Eun-Joo Lee and Han-Seung Shin</a></blockquote><h4>Temperature/Humidity</h4><p>Currently, temperature sensors is the only solution currently on the market that have tried to change expiration dates (<a href="https://www.tempix.com/the-indicator">Tempix</a>). These sensors detect the temperature within the package, and if it goes above a certain threshold, then there is some physical reaction, such as a black line showing up. However, the main problem with this is that <strong>just because the temperature was elevated above the threshold at a certain point doesn’t necessarily mean that the food is spoiled</strong>. It’s also not optimized for consumers but instead for businesses to sense if there is a break in the supply chain, which can cause the integrity of the food to be compromised.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*LjRaU360bt2gxnVv" /></figure><p>This problem also extends to humidity sensors since humidity levels are subjective to being manipulated. This can occur when the packaging is exposed to prolonged temperature fluctuations. Thus, condensation can occur, which compromises the accuracy.</p><h4>Volatile Organic Compunds (VOCs)</h4><p>Volatile organic compounds are compounds produced when the meat starts to go bad. When certain bacteria such as E.coli, Pseudomonas, and Enterobacteriaceae eat the sugars on the surface of the meat, they start to release certain chemicals. The family of these chemicals is called VOCs. The main one we can use to detect meat spoilage is the family of <strong>volatile basic nitrogen (VBN)</strong>. Current literature states that once meat produces over 20mg of VBN per 100g of meat, we can rule that piece of meat as spoiled. This would as our indicator for spoilage, so our sensor would try to detect these VOCs. And since these gasses are a <strong>direct result</strong> of bacteria that cause food spoilage, we can confidently use this as an accurate indicator. This is supported by current scientific research:</p><blockquote>“Results show that volatile organic compound concentrations increased with higher bacterial counts (5.0–7.0 log10 cfu/mL). Bacterial counts correlated closely with acetaldehyde, butanone, ethanol, hexanal, acetone and fatty acid concentrations” — <a href="https://onlinelibrary.wiley.com/doi/abs/10.1111/1471-0307.12557"><em>Correlation of volatile compound concentrations with bacterial counts in whole pasteurised milk under various storage conditions</em></a></blockquote><h3>Conclusion</h3><p>Now that we have a decided decision platform and indicator, we can now combine them. So, in theory, the best solution that we can have to this problem is developing a gas sensor, whether through nanotechnology or finding a reactive polymer, which can detect volatile basic nitrogen at<strong> </strong>concentrations of 20mg per 100g of meat. When it detects this threshold, it can then change color, which can indicate to the user whether the food has been spoiled.</p><p>In the end, such a solution can have a massive impact. According to Natural Resources Defense Council (NRDC), by creating a clearer label, <strong>we can reduce US food waste by 8%</strong>. This might not sound like much, but 8% of 80 billion pounds of food is 7 billion pounds which is enough to feed 14 million people. By having clearer expiration date labels, <strong>we could cut food insecurity in America by 1/3.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0MpLNT1dSsslK7Z-ocmKA.png" /><figcaption>Mockup by Author</figcaption></figure><h4>Hello 👋</h4><p>Hi, my name is Saeed Tamboli. I am currently a 10th grader interested in solving global problems with emerging technologies and policy.</p><p>If you are an expert in the field, please reach out. I would love to have a chat. And if you have any feedback feel free to reach out to me! <br>Email: ss@tambo.li<br><a href="https://www.linkedin.com/in/saeed-tamboli/">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77714ed9237c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to never again let food go to waste]]></title>
            <link>https://medium.com/@saeed_tamboli/using-material-science-and-iot-in-order-to-identify-if-your-food-has-really-gone-bad-ff61e6d9234f?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff61e6d9234f</guid>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 01:22:36 GMT</pubDate>
            <atom:updated>2023-01-01T18:26:17.505Z</atom:updated>
            <content:encoded><![CDATA[<p>Using material science and IoT in order to identify if your food has really gone bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cBWsTrquMrc65Tet" /></figure><p>Photo by <a href="https://unsplash.com/@pwign?utm_source=medium&amp;utm_medium=referral">Anh Nguyen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></p><p>We have all let a carton of milk or a box of pizza go bad since it was all the back in our fridge. Then we processed to throw it out. Whenever we get any food into our house, you have a ticking time bomb on your hands. In order to delay the timer you need to store the item appropriately and you need to make sure that you use it before it goes bad. Then you need to prepare and eat it in time before it goes bad.</p><h3>Why does food get spoiled?</h3><p>You are not the only thing that wants to eat the food; micro-organisms are also trying to use that food for survival. By eating those foods, they are able to multiply and grow, and as a result, mold forms.</p><p>However, they aren’t the only cause of food spoilage. Enzymes are also responsible for food spoilage. Enzymes speed up chemical reactions, and in this case, they help the breakdown of molecules within your foods. It’s for this reason that milk goes bad since it breaks down complex molecules such as the protein and lipids in your milk. Enzymes are also responsible for ripening your foods, such as apples and bananas but leave them out for too long, then you let them go stale. This is because these enzymes are relentless and will continue to break down these molecules into harmful and useless substances.</p><p>This isn’t the end of the story since while these are the 2 main players, there are some reasons why they are able to thrive. These include:</p><ul><li>Air</li><li>Light</li><li>Insects, Rodents, Parasites, and Other Creatures</li><li>Moisture</li><li>Temperature</li><li>Time</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/0*Jz526B9cp1hiBqet.jpg" /></figure><p>If you would learn more about how these factors contribute to food going bad, check out this <a href="https://food.unl.edu/how-food-spoils">link</a>. Also, check out <a href="https://www.youtube.com/watch?v=MCOamVlWk0E">this</a> cool video showing why air isn’t the only factor when it comes to food going bad.</p><h3>How can you tell if food gets spoiled?</h3><p>Besides the obvious visual and sensory signs such as mold and a horrific smell, how can we chemically detect if food has gone bad? When meats go bad you can tell by the production of gasses such as hydrogen sulfide, dimethyl sulfide, trimethylamine, and cadaverine. These are the 4 that <a href="https://cen.acs.org/articles/94/web/2016/12/Handheld-artificial-nose-sniffs-rotting.html#:~:text=The%20researchers%20chose%20to%20detect,sulfide%2C%20trimethylamine%2C%20and%20cadaverine.">researchers used at the University of Illinois</a> in order to detect if food has gone bad or not.</p><p>Rotting foods also produce harmful gasses such as methane, carbon dioxide, and ammonia which are very harmful to the environment. Landfills that have spoiled food in them make massive amounts of these destructive greenhouse gas. For that reason why composting is so important since you are then able to turn these foods into useful resources along with stopping their production of these harmful gasses.</p><p>Here is a list of some other gases that could be used to detect food spoilage:</p><ul><li>Ethylene (a by-product of ripening)</li><li>Various alcohols (by-products of fermentation)</li><li>Acetic acid (a by-product of fermentation or oxidation)</li><li>Short-chain fatty acids (by-products of oxidation and oxidative rancidity)</li><li>Other volatile organic compounds.</li></ul><h3>How can you detect if the food is spoiled?</h3><p>With the power of IoT, you can use sensors that detect these various chemicals in order to determine whether a food has gone bad or not. For example, methane sensors are cheap and reliable, which makes them perfect for the job.</p><h4>What is IoT</h4><p><strong>The Internet of Things (IoT) is a network of devices, such as sensors, computers, etc, that share information and data with each other through the internet.</strong></p><p>Let&#39;s go over an example of trying to sense a gas with IoT:</p><p><strong>Part 1: Hardware<br></strong>The hardware in an IoT application could be the sensor, the computer (ie, Rasberry, Arduino, etc), and other modules such as Bluetooth or wifi that connect it to the cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rpHHV3zsZ3TyaZDD" /><figcaption>Photo by <a href="https://unsplash.com/@vishnumaiea?utm_source=medium&amp;utm_medium=referral">Vishnu Mohanan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Part 2: Software<br></strong>But what really is the cloud? When something is in the cloud, it means it’s stored on a network of remote servers hosted by the Internet instead of being directly on the computer. This has some advantages. It can allow you to have a central point for collecting information which can allow you to do data analysis. However, in this case, we will not need that.</p><h4><strong>Applications of IoT</strong></h4><p>One implementation of IoT is the smart fridge. These refrigerators are able to detect food spoilage within our own refrigerators. And while none have come to market, there has been a patent filed in order to make this new smart fridge.</p><p>These smart fridges will be able to “sniff” out whether your food has gone bad or not. As a result of this data, it will be able to tell you whether your food has gone bad or not. One interesting statistic by the USDA estimates that if American families ate all the food they bought they could save about <a href="https://www.mentalfloss.com/article/74796/limiting-food-waste-can-save-you-1500-year">$1500 a year</a>, showing how much of a problem spoiled food is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*NXn9mguhT0Q2JZ8a.jpg" /></figure><p>Amazon’s patent filling of a smart fridge</p><p>However, the main problem with such as solution is the inability to determine which food item is causing methane production. So instead of telling you which food item has gone bad, it’s just telling you something has gone bad.</p><p>The other solution is using cameras and AI. By using computer vision, you can be able to tell whether an item of food has gone past its due date. These solutions can detect any visual flaw, but that’s the problem. Anyone can see if mold is on a piece of fruit, but what people can’t tell is whether the food has gone bad or not.</p><p>Not all signs of food going bad are visual, nor can you smell them. They are sometimes in the gasses that these foods emit, and society’s current solution is “sell by labels” and its other counterparts. However, these labels are often wrong, with them being way earlier than the actual date the food goes bad. It’s because of this that an estimated <a href="https://www.gao.gov/products/gao-19-407"><strong>full third of the food produced in the U.S. is wasted due to consumers’ confusion over labeling.</strong></a></p><p>Now a potential solution to that is creating a Tupperware lid that can sense these gasses. This can be done by embedding sensors into it, and once the sensor detects an amount above a certain threshold, then it turns a light on, thus indicating that the food has gone bad. However the main problem with such a solution like this is trying to shrink it down to be small and to make sure it can be powered for time.</p><h4>Material Science</h4><p>Not every problem needs nor can be solved with technology in the traditional sense. But sometimes, we need to venture into the scientific field to find new and creative solutions that could help us solve this problem. One of these areas is material science.</p><h4>What is Material Science?</h4><p>Materials are really cool. We might not think about them in our day-to-day lives, but every material in our house, phones, and other human-made objects is chosen deliberately. Take, for example, a simple ice cream scooper, the metal for that scooper was chosen for a reason. That metal is highly conductive, thus allowing the heat from your hand to pass through to the tip of the scooper, which makes it easier to scoop. And the process of determining what material to use for certain applications is called material science.</p><p>In this case, we have found the solution of <strong>colorimetric sensors</strong>. These sensors will change colors when exposed to certain gases. Such a solution makes it easier for the consumer to understand whether the food has gone bad or not. Additionally, it&#39;s adaptive; for example, if you forget you left your meat on the counter for too long, it invalidates the expiration date. However, if we use this solution, it can adapt to its surroundings and give us an accurate update on the condition of the food.</p><h4>What are the gaps that prevent everyone from doing this?</h4><p>There are 4 main reasons why this hasn’t been implemented widely,</p><ol><li>These colorimetric sensors are <strong>not yet mass-produced</strong> due to an unoptimized manufacturing process.</li><li>In particular, there is <strong>no standardization</strong> of indicator spots. Most existing ones can only be comprehended by academics.</li><li>There is also <strong>limited integration </strong>with existing food packaging.</li><li><strong>Limited products</strong> have been tested</li><li>Most of the products on the “market” <strong>only detect the pH</strong>, which can lead to inaccuracies and harder standardization compared to directly sensing VOCs</li></ol><h4>What are the consequences of eating spoiled food?</h4><p>There is a wide range of different types of food born illnesses. But they act similar to any other virus, they try to take over your cells as hosts in order to reproduce. Sometimes these bacteria/viruses can even trigger the part of your brain that wants to make you vomit. It’s because of your immune response you can suffer from diarrhea to vomiting when experiencing food poisoning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff61e6d9234f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Illegal Fishing Using AI]]></title>
            <link>https://medium.com/@saeed_tamboli/detecting-illegal-fishing-using-ai-af1268aac5cf?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/af1268aac5cf</guid>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Sat, 14 May 2022 13:24:13 GMT</pubDate>
            <atom:updated>2022-10-20T21:57:20.927Z</atom:updated>
            <content:encoded><![CDATA[<p>Building an InceptionTime model to detect illegal fishing around the world</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NfRCDepqOokWajFq" /><figcaption>Photo by <a href="https://unsplash.com/@noaa?utm_source=medium&amp;utm_medium=referral">NOAA</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Illegal fishing and overfishing are topics we know very little about. I am sure that many of you have seen those videos of massive boats just sweeping up fish from the ocean, but other than that, we just went scrolling on with the understanding that it’s just another example of humans destroying the planet because, to be honest, we have been oversaturated with that news.</p><p>I was just like that until I watched a documentary on Netflix called Seaspriracy, which showed the impact that illegal, unreported, and unregulated (IUU) fishing has on our world. Because not only does it contribute to overfishing, and thus affecting our environment, but a host of other problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Ba73PztC6cH7gxLI.jpg" /><figcaption>Image by Netflix</figcaption></figure><h3>What’s the big deal with IUU fishing?</h3><p>IUU fishing has become a very profitable business, with nearly $23.5 billion worth of fish stolen from the world’s oceans. IUU fishing has become so prevalent that an estimated <strong>1 in 5 fish sold for commercial use</strong> has been caught through IUU fishing. This market has attracted terrorist organizations and cartels as another source of income to fund their operations. This means that the fish you buy at the market has a 20% chance of helping fund illegal activity.</p><p>Unsurprisingly, the way business is conducted on these ships isn’t glamorous either. These operations almost always use human trafficking to get cheap labor; they abduct people from countries where the police forces can’t keep up with the crime in the area. These kidnappings primarily occur in low-income countries such as Vietnam, Somalia, or places where people will do almost anything to feed their families. Once these criminal organizations have abducted innocent people, they treat them like slaves. Beating, torture, and lack of food are the norm in places like these. They are forced to work for YEARS on end without a break. With all these factors playing in their favor, these criminals can fund their operations, steal a nation’s resources, and abduct humans, leading to the destabilization of countries. This destabilization reduces the quality of life of all those in the country.</p><p>So, in the end, those being affected by these problems are those who are already suffering a lot, and it&#39;s not stopping. A report was done by Caught-Red Handed who surveyed over 100 marine experts from countries in the Indian ocean such as Somilia, Kenya, Shri Lanka, and more. These results show the impact that IUU fishing has on our world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*8npfRgicZ0-mmkZV.png" /><figcaption>By: <a href="https://securefisheries.org/sites/default/files/caught-red-handed-maritime-security-indian%20ocean.pdf">Caught-Red Handed</a> fg.1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/0*c-5n9GH-fQuzRw_C.png" /><figcaption>By: <a href="https://securefisheries.org/sites/default/files/caught-red-handed-maritime-security-indian%20ocean.pdf">Caught-Red Handed</a> fg.2</figcaption></figure><h4><strong><em>TLDR</em></strong></h4><ul><li>IUU fishing is a massive problem, with over 1 in 5 fishing coming from these sources</li><li>It is the reason for government destabilization (fg.2)</li><li>It helps contribute to many other illegal activities such as terrorism, and human trafficking (fg.1)</li></ul><h4>The Problem of Bycatch</h4><p>Illegal fishing has become even more problematic and complicated over recent years because those participating in IUU fishing have gotten really good at their jobs. They use boats called trawlers. These boats are remarked as the “grim reapers of the sea” because they kill anything and everything in their path. These boats stretch a net all the way to the seabed and take in everything in their wake. This term is called bycatching. In other words, bycatch <strong>is any other animal caught besides the target species the fishers are looking to acquire</strong>. Since these are fish that the sailors don’t want, they are thrown back into the sea.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*X3eFd0kQLuc0c2H5" /></figure><p>The practice of bycatching is so common that <strong>40% of all marine life caught has once been caught as bycatch</strong> and thrown right back into the ocean. In the end, hundreds of millions of dead fish are thrown in the water, a massive waste of potential food. However, not all fish are wasted in this manner. Sometimes the fishermen take the smaller fish and ground them up into a fish paste. This fish paste is sold mainly as pet food, such as cat food.</p><h4>The Impact of IUU Fishing on Our Environment</h4><p>Overfishing of these small fish that are subject to bycatch has a specific impact on the environment. Since these fish help maintains coral reefs and the surrounding aquatic environment. Overfishing also impact larger fish, who not only maintain their own aquatic environment but ours as well. Nearly half of the oxygen produced comes from whale feces, which react with phytoplankton in the sea. This process not only adds oxygen but also removes it. So, in essence, “<em>if the ocean dies, we die</em>” — Paul Winston.</p><p>Discarded fishing nets also negatively contribute to the ocean’s environment. In fact, nearly half of the Great Pacific Garbage Patch is made of fishing lines and nets. These materials are much deadlier than plastics because these nets were designed to kill; thus, even when discarded, these nets just keep on killing sea life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*wKEiiF4YYuMtJxlS.jpg" /></figure><h4>Why Hasn’t There been Action?</h4><p>While governments that have massive economies like the United States, which have strict regulation over<strong> </strong>fisheries<strong> </strong>and enforcement that largely prevents IUU fishing in its own waters, countries that don’t have these resources fail in this regard. But this doesn’t mean large countries are completely out of the problem since IUU fishing is propelled through 2 factors:</p><ol><li>Lack of enforcement of a countries waters</li><li>Lack of security within the fish supply chain</li></ol><p>The more developed countries consume these fish that come from these illegal sources. And in places where more exotic foods are consumed such as China, there is a massive market for people to take advantage of. Thus for some countries like china and japan, which just resumed whale hunting, there isn’t that much of an incentive for making sure the supply lines are getting fish from ethical sources.</p><p>But on the other side of the world, where consumers are becoming more and more aware of what they are purchasing and its effect on the environment, there is also a problem here. <strong>Throughout this article, you might have thought that you are not a contributor to this problem (me included) since at the grocery store you make sure there is some guarantee which makes sure that the fish come from ethical sources.</strong></p><p>However, many of these non-profit organizations such as Dolphin Safe and MSC, which reviews canned tuna to ensure no dolphins are harmed, have come under fire for not being strict enough with their labels and for general corruption. Thus, allowing fish caught illegally into the supply chain and not allowing us consumers to impact this problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdrVJcNsfdsqPJ7rZNhgwg.png" /><figcaption>Image by Author</figcaption></figure><p>The other part of the equation on why there hasn’t been change is because those countries that are being affected by this problem, really don’t have the ability to tackle the problem. These countries are taken advantage of due to their inability to monitor their own oceans. Additionally, due to the idea of innocent passage, it&#39;s not as if a country can completely lock down its coastlines to prevent boats from coming in. So boats come in and out and these countries don’t know whether they are fishing or not. Since you can just look at a radar ping and from that determine whether a boat is fishing or not. So this presents the problem of a lack of enforcement for these countries&#39; coastlines.</p><h4><strong>What has been done to protect our seas?</strong></h4><p>There has been some effort in order to solve this problem. For example, the EU has created forms to declare where the fish has come from, however, the enforcement and the current estimates are putting this initiative as a failure. Additionally, it has the potential to hurt small fishers. So in order for there to be real change in the policy change, it would require a broad and widely accepted initiative, one that some countries aren’t willing to accept due to the economic advantages that come from illegal fishing.</p><h3>So Now What?</h3><p>That was me when I finished watching the documentary, it was insane how this massive problem has just been swept under the radar and no one cares about it.</p><p>I couldn&#39;t help with policy, and still can’t but I could help on combating it directly. That&#39;s when I learned about <a href="https://globalfishingwatch.org/">Global Fishing Watch</a>, they are a group of researchers dedicated to solving this problem of IUU fishing with AI. In order to be transparent, they even have made a free public dataset for anyone to use.</p><p>However, when doing some research for this project they saw that the people at GFW were using a relatively dated model architecture for time-series classification. That&#39;s when I researched and saw a brand new model that shows a lot of promise for time-series classification called InceptionTime. So I decided to use this new model architecture to solve this problem in order to achieve a better result.</p><p>Now I am going to go over the data, the InceptionTime model, and then end with some final thoughts.</p><h4>The Data</h4><p>When starting any ML project finding and pre-processing a source of data is always the hardest part of the project. Additionally, we need to make sure the data we get can be accepted into the model. These are the main phases we took for pre-processing.</p><ol><li>Cleaning the data</li><li>Interpolation of the time-series</li><li>Generating sensible training points</li></ol><p>This is the data from GFW</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4ZcLOY-Vi2RMY82bZ1DTw.png" /></figure><p>When cleaning the data I just dropped some unnecessary columns such as distance from shore since it was found that it was highly correlated to distance from the port. Because of this, I decided to drop it because I didn’t want to the give model extra data that really doesn’t contribute much information. We also merged the labels and data CSV files together for training and this was the final product after doing some general cleaning of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXQSRgY7-l6z8vhwK37O0w.png" /></figure><p>Now we move on to interpolation. What this basically means is that we make up some data for lost data. The timesteps we have, as seen above, aren’t even time intervals. Thus in order to make sure our model performs well we need to make this interval the same across all of the different data points. By using Numpy we make this happen (we used the nearest method).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*o8BaNTWnbVNYOz-3Qo1TZA.png" /></figure><p>Finally, we move on to one of the more confusing parts, generating sensible training points. If we were to pass this data into the model, and since it was based on a CNN thus not be able to “relate” each time step to one another, like an LSTM would, we need to do some tweaking to the data.</p><p>For some more clarification, this is being done because the model can’t tell whether the boat was fishing or not based on just one data point. Thus it needs to look at multiple points at a time, so we picked 25. 24 hours in the past + the current hour. And we use the label of the current hour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*yJm7_Rn3__PPUIO7" /></figure><p>And just like that, we are done with pre-processing the data.</p><h4>The InceptionTime Model</h4><p>The reason why I selected this model is because of its accuracy. This model in testing has shown that it could beat many other time-series, classification models. Additionally, it is also scalable, meaning that if we add more data the model will get better and won’t just plateau at a certain point. It also can handle more data and won’t take forever to train. In fact, compared to the previous best model, HIVE-COTE, InceptionTime is 100x faster when having a huge number of training instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*ETW19sef9E22m2h-.png" /></figure><p>The reason for this is because of its implementation of the inception module. But first a little history lesson. The most used models for time-series classification are CNNs or varients of a CNN such as a 1-D CNN. This to me was crazy. Why would a model that was made for image processing be used for time-series problems?</p><p>In the simplest terms, the reason for this is because of a CNN’s ability to relate different pieces of data together. When doing image processing the CNN is able to pick up patterns. For example, if you have the task of determining whether a picture is a cat or a dog the CNN is able to look at surrounding pixels and determine whether it is a dog or a cat, in other words, spatial/temporal recognition.</p><p>So its ability to use the context around it in order to develop a conclusion is what we are looking for in time-series classification. This is because we need to look at the surrounding data points in order to determine whether the boat was fishing or not. Because remember the goal in order to solve this problem is finding patterns, the more context there is the better pattern recognition we can have.</p><p>Now let&#39;s move on to the inception module, now that we understand the bigger picture. This inception module has been used in image processing as well and has shown great promise in those tasks. Thus translating it over to a time-series classification task makes sense.</p><h4>Inception Module</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DD4hBAiOyBQxXxJr.png" /></figure><p>The reason why the inception module is better is because of its ability to have multiple filters. As you can see there are different types of 1D convulsions happening, with different weights and biases. As a side note, the reason why there are 1D convulsions is because of the task we are doing. Since this isn’t an image we aren’t doing a 2D or 3D convolution. Since images have multiple dimensions, for example, height, width, and color.</p><p>In summary instead of the network being restricted to just one of these filters or operations the network could instead choose which one it wants.</p><p>But this brings in the problem of complexity and computational cost. Since there are more options it would take longer to train. However, this is countered by the bottleneck layer, which decreases the size of the operation, by applying a 1x1 convolution. This shrinks the size of the numbers we are dealing with thus making us able to compute much faster.</p><h3>Quick Links/Final Notes:</h3><p>If you would like to see the code in full and the accompanying video, you can see the links below.</p><p>Github: <a href="https://github.com/Sayeet/Illegal-Fishing-Detection-using-InceptionTime-Model">https://github.com/Sayeet/Illegal-Fishing-Detection-using-InceptionTime-Model</a></p><p>I would also like to give a massive shoutout to <a href="https://no.linkedin.com/in/bjsingstad">Bjørn-Jostein Singstad</a> for helping me out with this project.</p><p>Additionally, I am trying to improve this project and one of the things I am having trouble with is implementing hyperparameter tunning. If you would like to help out please reach out to ss@tambo.li</p><p>Here is the accompanying video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyDvM37OtKfo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyDvM37OtKfo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyDvM37OtKfo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf1d5574d7fc0699bfb0c0db27da644d/href">https://medium.com/media/cf1d5574d7fc0699bfb0c0db27da644d/href</a></iframe><h3>Quick Note about Me🚀:</h3><p>I am a 9th grader that is interested in AI. I am constantly looking for new opportunities so feel free to contact me on <a href="https://www.linkedin.com/in/saeed-tamboli/">LinkedIn </a>or <a href="https://substack.com/profile/50498471-saeed-tamboli">subscribe to my newsletter!📰</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af1268aac5cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Made an (almost) Unbeatable Pong Player using AI]]></title>
            <link>https://medium.com/@saeed_tamboli/how-i-made-an-almost-unbeatable-pong-player-using-ai-cb956d30ce7f?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb956d30ce7f</guid>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Thu, 17 Mar 2022 02:17:25 GMT</pubDate>
            <atom:updated>2022-03-29T01:25:45.000Z</atom:updated>
            <content:encoded><![CDATA[<h4>By using the NEAT algorithm I was able to make a model that could beat me in pong</h4><p>Pong is a very simple game. We all know what it is, 2 players try to hit a ball with a paddle. Because of its simplicity and being one of the first computer games, it was a prime target for being playable with Artificial Intelligence (AI) So in this project I recreated this simple task with a unique spin, using the NEAT algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ur2YtRHCWtoP_nvR7aG1Sw.png" /><figcaption>Image by Author</figcaption></figure><h4>What is the NEAT algorithm?</h4><p>NEAT or NeuroEvolution of Augmenting Topologies is the process of generating or maturing neural networks. Think of it like this, neural networks, the things that AI’s are made of, are like humans. Over time they evolve and with these evolutions, they become better. This is though a process similar to natural selection where if they have lackluster performance, in this case, called fitness, they will be deleted and the better neural network will survive.</p><p>This sounds harsh but remembers we are doing this to computer algorithms, so we can pretty much do whatever we want.</p><p>Addiotnlly, NEAT isn’t the only revolutionary algorithm that uses the idea of applying the idea of natural selection to these algorithms. But there are some unique things about it mainly how it applies to neural networks. One of the cool things about NEAT is that it can introduce mutations to the mix.</p><h4>What are mutations?</h4><p>The thing that made NEAT interesting is that, compared to previous works, it affected the structure of the neural network and not just the weights. So what this boils down to is that NEAT can add or take out connections between the nodes or the nodes themselves in the neural network. This allows for more variables and thus increases the potential of the produced algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/0*2w4X99gI_8Gmqzdb.jpg" /></figure><h4>Overview of crossover</h4><p>Sometimes you might want to combine or breed 2 different neural networks. This could be done by using the crossover. This will basically combine the networks together, they will take the historical marking, basically, the number corresponding to the change in the neural network and they will merge them by being random. This is similar to what happens in genetics, think of punnets squares and how those are random.</p><h4>How do we select the networks we want?</h4><p>This can be done by looking a the fitness of an algorithm. For this project, we calculate the fitness of the model based on how it performs against the other bots. We make every bot play against every other bot to ensure that we don’t have bad bots playing against decent bots and then we only pick the decent bot when in reality we could get something way better.</p><p>So we use a playoff-like structure to determine the best bots. Once we get the best bots we then run mutations and cross over on them. This results in us getting the best bot possible for us to play against.</p><h4>Details of the project</h4><p>If you would like to see the bot in action and play against me click here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FeDIV8Bg6b9s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeDIV8Bg6b9s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FeDIV8Bg6b9s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/220888b7b13c128e2cee7570676d220c/href">https://medium.com/media/220888b7b13c128e2cee7570676d220c/href</a></iframe><p>Here is the link to the code for this project:</p><p><a href="https://github.com/Sayeet/AI_Pong">https://github.com/Sayeet/AI_Pong</a></p><p>If you would like to see more in-depth about the code and the tutorial I used click here:</p><p><a href="https://www.youtube.com/watch?v=2f6TmKm7yx0">https://www.youtube.com/watch?v=2f6TmKm7yx0</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb956d30ce7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Location Intelligence and Artificial Intelligence]]></title>
            <link>https://medium.com/@saeed_tamboli/an-introduction-to-location-intelligence-and-artificial-intelligence-ca55800cee69?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca55800cee69</guid>
            <category><![CDATA[location-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Sun, 20 Feb 2022 20:17:57 GMT</pubDate>
            <atom:updated>2022-02-20T20:17:57.443Z</atom:updated>
            <content:encoded><![CDATA[<h4>How location intelligence combined with artificial intelligence has and will continue to have a massive impact on our world.</h4><p>There is a common saying in real estate: location, location, location. The location of a house can drastically increase or reduce the property’s price. This is similar to humans — kind of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*NB1UDPHwxs9SerWm.png" /></figure><p>Where a person has been, currently is, or will go can be very beneficial to first responders, insurance companies, and more. This information is called <strong>location intelligence </strong>(LI). In order to maximize the potential of location intelligence, it is imperative to process and analyze location data efficiently. That is where <strong>artificial intelligence </strong>(AI) comes in handy. So when we combine <strong>both technologies</strong> together we can make better decisions for our business and societies.</p><p>Before we get into the nitty-gritty of this topic, here is an outline of what I will be talking about in this article:</p><ol><li>The Case for Location Intelligence and Artificial Intelligence</li><li>How to Collect &amp; Process the Data</li><li>Key Takeaways</li></ol><h3>Examples of LI and AI</h3><p>Why should we use location intelligence and artificial intelligence, and why should you care about this article? Well, you should care because it can disrupt many industries and solve many problems. <strong>Here are 3 case studies on how LI and AI have changed the way we live.</strong></p><p><strong>Case Study 1:</strong> <strong>Car Congestion In India</strong></p><p>According to the Air Quality Index (AQI), air pollution in Delhi is so harmful it is like smoking <a href="https://economictimes.indiatimes.com/news/politics-and-nation/delhi-air-right-now-is-like-smoking-50-cigarettes-a-day/killer-air/slideshow/71789493.cms"><strong>50 cigarettes</strong></a> a day. This pollution is mainly caused by cars. And, with nearly<a href="https://www.statista.com/statistics/665712/total-number-of-vehicles-registered-in-delhi-india/#:~:text=Number%20of%20registered%20motor%20vehicles%20in%20Delhi%201988%2D2020&amp;text=In%20the%20year%202020%2C%20there,registered%20motor%20vehicles%20in%20Delhi."> <strong>12 million</strong></a><strong> </strong>vehicles on the road, about <a href="https://www.hindustantimes.com/cities/delhi-news/covid19-aftermath-longer-traffic-jams-newer-choke-points-in-delhi-101630953528718.html"><strong>40–60%</strong></a> of that time is spent in traffic. So, we are producing hundreds of metric tons of greenhouse gases doing nothing. Additionally, not only is congestion costing lives but it is also costing real money — nearly <a href="https://www.news18.com/news/tech/india-loses-usd-22-billion-a-year-in-peak-traffic-hours-in-4-indian-cities-uber-1722251.html"><strong>$22 billion</strong></a>! So, a company called Y&amp;R decided to tackle the problem of traffic in India using LI and AI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*DbJ_CBX-GLcZ2nrZ.jpeg" /></figure><p>In India, cows are very sacred animals. This means traffic could be held up because of cows crowding the roads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*TJZU2OVUsvfLh6jk.jpeg" /></figure><p>In order to solve air pollution and traffic congestion, Y&amp;R decided to place trackers on the cows by recycling old cell phones to admit a cellular signal. The cow’s location is then updated in real-time on the Traffic Gaaye app. After that, the app takes this location information, and by using AI, it calculates a route away from the cows to cut down on congestion and travel time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M9l2t3hwehd3ajtb.png" /></figure><p>This app allows users to save 15 minutes on average per trip and reduces emissions at peak hours. This shows how LI combined with AI can save time, money, and lives.</p><p><strong>Case Study 2:</strong> <strong>Logistics and Transport</strong></p><p>Have you ever wondered how Amazon can get you packages in only two days? Well, you might have guessed by now, since this is an article about LI and AI, LI and AI are probably involved. But, how do they use LI and AI?</p><p>Well, the problem that LI and AI solve in the first place is timing. For example, if your shipment from one vehicle to another is 20 minutes late, you are wasting 20 minutes of the time of the following vehicle because it’s just sitting there doing nothing. So this makes time the name of the game in logistics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*DwUTnn5tW5xclv94.jpeg" /></figure><p>LI and AI are finding issues that slow down the supply chain. They do this by looking over a dataset, with many parameters, over a period of time. Then, the software finds that the bottleneck could be caused by, but not limited to:</p><ul><li>The transfer of goods between different modes of transport (i.e., planes, ships, and trucks) 🛳️</li><li>Miscommuncations between various organizations (i.e., companies and governments)</li><li>Unnecessary large gaps in turnaround time ⏰</li><li>Lack of goods/raw materials arriving at a destination 🔩</li></ul><p>The data analyst can then recommend solutions to these problems such as:</p><ul><li>Change the mode of transportation ✈️</li><li>Better communication methods ☎️</li><li>Train an inexperienced workforce</li><li>Measure an organization&#39;s ability to provide these goods and diversify the source of goods.</li></ul><p><em>(All the solutions are respective to the problems above.)</em></p><p>This software can help minimize the time supply chain managers spend on finding problems and reallocate this time into finding solutions for these problems.</p><blockquote>“An AI-fueled approach to location intelligence can support those plans and foster growth in three ways: by automating processes, detecting patterns within large sets of data, and making predictions.”</blockquote><blockquote><em>~ </em><a href="https://www.mckinsey.com/industries/healthcare-systems-and-services/our-insights/beyond-coronavirus-the-path-to-the-next-normalhttps://www.mckinsey.com/industries/healthcare-systems-and-services/our-insights/beyond-coronavirus-the-path-to-the-next-normal"><strong><em>McKinsey</em></strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TnxzQXFzxewMdbjI.jpeg" /></figure><p><strong>Case Study 3:</strong> <strong>Store Placement</strong></p><p>If you are a small franchise, the location of your next store matters. If you go into a place where there are no customers, you will get no money. If you place a Subway within five blocks of another Subway store in New York City, you will make no money. Location is crucial for a business, and finding the right place is vital for your business to survive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*-Wgq8G5PC6UFmHe8.jpeg" /></figure><p>Yet again, LI and AI can help with that. Esri, a GeoAI company, has developed a tool that takes in nearly 6,000 parameters about customers in a specific area and gives recommendations and predictions about the outcomes of store placement at a particular location. This can help small businesses grow quicker and more effectively.</p><h3>Collecting &amp; Analyzing Data</h3><p>LI and AI are cool and all, but how does this work? Well, it’s pretty simple; first, you have to collect location data and other information, and then that data is processed using AI to give you actionable items to work on. But, the question now is how do you actually collect and process this data.</p><h4>Collecting Data</h4><p>There is a tool developed by Esri, the leader in the space of AI and LI, called ArcGIS. This tool is what you use to collect and analyze the data. There already is existing spatial data for everyone to use, so you don’t need to collect everything from scratch. However, if you need to collect some data that isn’t already in the database, you can collect your own using the ArcGIS Collector. Which is a mobile app that can help you collect custom data points for your specific use case. Then to prepare this data for analysis, you can use ArcGIS pro, which will put all the information together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*T7kGWLJFtMwrtwBX.png" /></figure><h4>Analyzing Data</h4><p>For analyzing the data, you can still use the ArcGIS suite. You can import the data from ArcGIS Pro and insert it into ArcGIS online, which will compile all of the data and give you a visual representation for you to interpret the data and find the solution to your problem. If you want a more in-depth overview of the process, click <a href="https://community.esri.com/t5/esri-training-blog/use-the-five-step-gis-analysis-process/ba-p/899436">here</a>.</p><h3>Key Takeaways</h3><blockquote>“The application of GIS is limited only by the imagination of those who use it”. ~ <strong><em>Jack Dangermond, Esri</em></strong></blockquote><ul><li>Location Intelligence (LI) and Artificial Intelligence (AI) have massive potential in changing the way we do business and live</li><li>LI and AI have already been implemented in creative ways to solve problems as small as cow traffic to as large as logistics and transportation</li><li>Ersi, with their tool ArcGIS, is the basis of collecting and analyzing geospatial data</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca55800cee69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Stop Hate Crimes Around the World with AI]]></title>
            <link>https://medium.com/@saeed_tamboli/how-to-stoping-hate-with-machine-learning-4e0277a98be3?source=rss-f422f50126ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e0277a98be3</guid>
            <category><![CDATA[students]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[hate-speech]]></category>
            <dc:creator><![CDATA[Saeed Tamboli]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 22:36:23 GMT</pubDate>
            <atom:updated>2022-10-12T00:39:39.521Z</atom:updated>
            <content:encoded><![CDATA[<h4>This is an overview and explanation of how I made a multilingual hate speech model using AI and NLP.</h4><h3>A Tragedy</h3><p>On June 6th, 2021, the Afaazl family took an evening stroll around their neighborhood. It was an average Canadian family until it wasn’t, a truck with 20-year-old Nathanial Veltma armed with hate was able to take out 3 generations of the Afaazl family, in a blink of an eye. This was all done because of one man’s skewed perception of Islam and hate groups online entices others to commit these crimes to Muslims and other marginalized groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/0*AEuXIL_PcBs-fs6F.jpg" /><figcaption>A makeshift memorial for the victims was set up at the scene of the attack. Source: REUTERS</figcaption></figure><p>Additionally, over the pandemic more and more people are becoming subjugated to dehumanizing treatment, with a<a href="https://www.justice.gov/hatecrimes/hate-crime-statistics"> 13% increase of hate crimes from 2020 compared to 2019</a>.</p><p>However, even though this problem seems very daunting it has a solution, using artificial intelligence (AI) to detect hate speech on social media platforms such as Facebook and Twitter.</p><p>The subsection of AI that we will be using is deep learning and Natural Language Processing (NLP).</p><h3>What is Natural Language Processing?</h3><p>Natural Language Processing (NLP) is the field where computers, more specifically AI, in order to understand language. There are many different NLP models, such as BERT, GPT-3, RoBERTa, and more. For this tutorial, we will be using BERT. (If you don’t know what that is don’t worry, I’ll explain it)</p><p>Just one quick note, there is a lighter version of BERT out there called distillbert. I will be using this model instead because</p><blockquote>“a small, fast, cheap and light Transformer model trained by distilling BERT base. It has 40% less parameters than bert-base-uncased, runs 60% faster while preserving over 95% of BERT’s performances” — Hugging Face</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*UmprvibrAxnlWvbmGPJT0g.png" /><figcaption>Photo by <a href="https://unsplash.com/@santesson89?utm_source=medium&amp;utm_medium=referral">Andrea De Santis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>How does NLP work?</h3><p>There are a couple of methods that NLP uses to understand words because remember computers can’t understand words but can understand numbers, but that means there are going to be some challenges when doing something like this.</p><h4>Tokenization</h4><p>Tokenization is the process of turning words into numbers. This allows the computer to look for patterns in the numbers and determine their meaning.</p><p>For example, let’s say we have a sentence, “I am happy” the program would tokenize this to 1, 2, 3. (1 = I, 2 = am, 3 = happy). Now let’s say we have another sentence, “I am sad”. It would tokenize this to 1,2,4. This is because “I” and “am” have already been used before thus added to the “dictionary” of the model.</p><p>Now let’s apply this knowledge to this specific problem. I am happy has the output of 0, which is “not hate”, and I am sad has the output of 1, which is “hate”. The model now knows that the second sentence was hate because of the word “sad”. That is the basics of tokenization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*goqQcTV2geBwxnBurc1YaQ.jpeg" /><figcaption>Image by Author</figcaption></figure><p>However, tokenization isn’t always whole words, it can be punctuation and parts of words such as -ing. That process is called <strong>steaming</strong>, which takes suffixes and prefixes and turns those into tokens. But there is another problem with this, take for example university and universal. The program might accidentally think that universal is related to university when in reality it isn’t. That’s when you have a process called <strong>lemmatization</strong>. This is when the model just references the dictionary to understand the meaning of these words. This is done by using the root words and words with similar meanings. For example, for university, it would reference college and for universal, it could reference worldly.</p><p><em>(Note: If you would like to research more into this topic, BERT more specifically, look and understand the </em><strong><em>WordPiece tokenizer</em></strong><em> since that is the one BERT uses)</em></p><h4>Padding &amp; Truncation</h4><p>Now all sentences aren’t the same length this makes batching these inputs into the model impossible. This is where padding and truncation come in. Padding basically adds 0 in order to make it equal to the length of the sentences the coder desires. If the sentence is too long, it will shorten it by taking out some words.</p><p>This all is called pre-processing when building the model but still gives a good idea of how NLP works. If you would like to learn more about pre-processing, I recommend you look at the <a href="https://huggingface.co/docs/transformers/preprocessing">BERT documentation</a>.</p><h4>TLDR</h4><ul><li><strong>Tokenization:</strong> The process of turning words into numbers</li><li><strong>Steaming: </strong>Taking suffixes and prefixes and turning those into tokens</li><li><strong>Padding: </strong>Adding 0’s in order to make the sentences equal length</li><li><strong>Truncation: </strong>This would take out certain words</li></ul><h3>What is BERT?</h3><p>BERT stands for Bidirectional Encoder Representations from Transformers. This was a model that was developed by Google in 2018 for NLP tasks. BERT is a transformer model, which is a new type of architecture for NLP models. Transformers were introduced in the paper “<a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a>”. The criteria of NLP models is that they should hold on to information. Basically, they have memory, or another way to say it is “attention”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RkEz40zzs8kygZ5x.png" /><figcaption>Source: analyticsvidhya</figcaption></figure><p>Originally there were RNN’s which were the first NLP models but then people developed LSTM’s and the next evolution of models are <strong>transformers</strong>. These models are able to<strong> contextualize the inputs much better</strong> than previous models. They additionally transformers <strong>the ability to train in parallel</strong> this makes it must faster to train compared to previous models since you can use multiple GPUs. All of these benefits prove useful in tasks such as sentiment prediction, spam filtration, and in this case, hate speech detection.</p><p>BERT is a pre-trained model, and the one that we are going to be using, multilingual distillbert was trained on the top<strong> 104 languages on Wikipedia</strong> pages and books corresponding to those languages. By using a pre-trained model it allows us to not need to retrain a model that probably took 100’s of GPUs and thousands of hours to train, and unfortunately, I don’t have those facilities. However, we can still look at how this model works.</p><h3>How does BERT Work?</h3><h4>Overview</h4><p>BERT is the encoder part of a transformer. If you would like to understand what a transformer is take a look <a href="https://www.youtube.com/watch?v=TQQlZhbC5ps">here</a>. This is how a transformer looks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*jDtDHacezMC7Xzco.png" /><figcaption>Image by <a href="https://arshren.medium.com/?source=post_page-----da1adfc5d64f-----------------------------------">Renu Khandelwal</a></figcaption></figure><p>BERT is <strong>only the encoder part</strong>. But many encoder parts are <strong>stacked together</strong>, as seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OwKrzJBxKxDoL6yC3N2Oag.png" /><figcaption>Source: <a href="https://www.youtube.com/watch?v=xI0HHN5XKDo">CodeEmporium </a>(Creative Commons Licence)</figcaption></figure><p>Now as referenced before BERT is a pre-trained model, which means that it can understand language. For example, it’s a person, however, for this task, we need a person that can understand what is hate or not. But this person doesn’t know that yet.</p><p>That is where fine-tuning comes in and that is the task we are doing. Fine-tunning, in this case, is giving the “person”, BERT, a bunch of examples of hate speech and non-hate speech.</p><p>This is done through a normal supervising learning task, with standard loss functions and optimizers, nothing special there. Below is what I used for the project.</p><ul><li><strong>Loss Function: </strong>I used BCEloss</li><li><strong>Optimizer: </strong>AdamW</li></ul><h4>The Technical Stuff</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*5c99Ue0oOgn68em_wkrreA.png" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><h4>Overview of the process</h4><ul><li>Input Embedding</li><li>Positional Encoding added to Input Embedding</li><li>Attention Mechanism</li></ul><h4>Input Embedding</h4><p>One of the first concepts that need to be understood are word vectors. <strong>Word vectors are basically a numerical representation of the word</strong>. Remember tokenization, in the beginning, is the number assigned to them. However, this isn’t only a single-digit it could also be something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*-pAtPcoVBJ1JSqGd.png" /><figcaption>Source: <a href="https://searchengineland.com/word-vectors-implication-seo-258599">Search Engine Land</a></figcaption></figure><p>It could also approximate the meaning of the word due to the distributional hypothesis in semantics which states:</p><blockquote>“more semantically similar two words are, the more distributionally similar they will be in turn, and thus the more that they will tend to occur in similar linguistic contexts.” — wikipedia</blockquote><p>This information is represented in a corpus. <strong>The corpus maps out how often words are next to each other.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMJZ-i6MWgje-Q_b8_rLww.png" /><figcaption>Source: <a href="https://www.youtube.com/watch?v=oUpuABKoElw">Rasa</a> (Note: for a great visual example view the video)</figcaption></figure><p>Now how does this relate to input embeddings? Well, this whole process is what the input embedding block does, it converts these words into word vectors.</p><h4>Positional Encoding added to Input Embedding</h4><p>Positional Encoding figures out where in the sentence the words are. This is different from input embeddings because <strong>it looks at the whole sentence and not just the relationship between certain words. </strong>In the paper, the authors proposed a novel method for this process, which is by using sine and cosine functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*eCnIrqkX-vFFLd4N" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><p>On a very high level what this does is <strong>every even word creates a vector using the sin function and for every odd word, it uses the cos function to create a vector. </strong>This vector details the position of the word. However, how can the position of the word have multiple numbers? Well, this is because as you go down the vector we can more accurately pin down where we are exactly. If you would like to learn more about this check out this <a href="https://towardsdatascience.com/master-positional-encoding-part-i-63c05d90a0c3">article</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*MBYL5tawQmJ45BqfLxQciw.png" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><p>This positional encoding is then added to the word vector and this is the input for the model. <strong>All in all what this achieves is the ability for the model to understand the relationship between words, the position of the word in the sentence, and uniquely identify each word.</strong></p><h4>The Attention Mechanism</h4><p>This is one of the most interesting things about NLP models, this mechanism isn’t only specific to BERT but all transformers and models based on them. The attention mechanism <strong>is what allows the model to look at the context of the sentence, <em>this is done by looking at the relationships of the words</em></strong><em>.</em> <em>Remember the model can get this data because of all of the techniques mentioned above in pre-processing.</em></p><p>The way the model is able to know what words to relate to other words comes from the training process of BERT.</p><p>Just a quick TLDR on how this training process works.</p><ul><li><strong>MLM or Masked Language Modeling: </strong>It removes certain words from the sentence and then tries to fill them in. This makes the model really understand the meaning of the word and its relationship to other words. If you have ever taken an interpretive test for another language you would know how difficult but rich in content the process provides.</li><li><strong>NSP or Next Sentence Prediction: </strong>This has the same idea as MLM, making the model understand the language better, but this takes it to the next level by making it predict whole sentences instead of just single words</li></ul><p><em>(Note: If you would like to learn how BERT pre-trains take a look </em><a href="http://jalammar.github.io/illustrated-bert/"><em>here</em></a><em>, this is a lot more interesting and technical!)</em></p><p>Another cool thing about the attention mechanism is that theoretically, it could have an <strong>infinite </strong>attention window. Thus allowing it to contextualize any size of text.</p><p>The specific module, in this case, is called the Multi-Headed Attention Module. This module takes in 3 inputs; query, key, and value. This explains what query, key, and value are really well.</p><blockquote>when you search for videos on Youtube, the search engine will map your <strong>query</strong> (text in the search bar) against a set of <strong>keys</strong> (video title, description, etc.) associated with candidate videos in their database, then present you the best matched videos (<strong>values</strong>). — <a href="https://stats.stackexchange.com/questions/421935/what-exactly-are-keys-queries-and-values-in-attention-mechanisms">Stack Exchange</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*yptnQHa16wKDeYmw9HUmmg.png" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><p>These inputs, vectors, are then put into a linear function. Which then are put through a scaled dot-product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*sd59mBTZuOA6-AnnHbhA5A.png" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><p>This can all be summarized by the following mathematical equation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*OgejD4ZKTBH37H0eDPA7DQ.png" /><figcaption>From: <a href="https://arxiv.org/abs/1706.03762">Attention is all you need</a></figcaption></figure><p>In summary, what this does first takes the dot product of the Key and Value values. In order to prevent the values from exploding thus making it computationally expensive or even impossible we take the square root of this dot product. Then we apply the softmax function and add up all of the weights. This leaves us with the relationship between each word in the sentence.</p><h3>The Status Quo</h3><p>This topic is very challenging. While we can get decent scores in closed environments such as in this case, with me getting a 64% accuracy, we are nowhere close to deploying this reliably. This is because hate speech is a very difficult problem since in some cases it can be different for different people. Another problem is where do you draw the line between offensive and hate speech. Because while something might be offensive to a certain group it might not quantify as hate speech. Addiontly, when there is such traffic it only helps these social media platforms, take that information as you need.</p><p>But on a more technical side, we just aren’t there yet. While both Google and Facebook claim to have an algorithm that can counter hate speech. Reports show that both don’t achieve this goal. According to <a href="https://www.facebook.com/david.auerbach/posts/10101520012739084">David Auerbach</a>, he shows that in these cases:</p><ul><li>“Jews are human”</li><li>“Hitler was an anti-semite”</li><li>“You’re no racist”</li></ul><p>The model said that these are all toxic. So from a technical perspective and a cultural perspective we just aren’t there yet. However, future releases of models such as GPT-3 that are way more powerful than BERT can hopefully change the future. So we don’t live in one where people are getting killed for walking down the street.</p><h3>The Project</h3><p>Now that we understand what is happening under the hood let’s take a look at the <a href="https://colab.research.google.com/drive/1d0XNaWXKQjtz4zterP0Yg_RuLjdOhsNg?usp=sharing">project</a>.</p><h4>Imports</h4><p>These are going to be the necessary libraries.</p><pre>import time<br>import torch<br>import numpy as np<br>from torch.utils.data import DataLoader, RandomSampler<br>from transformers import DistilBertTokenizer,AdamW, BertForSequenceClassification<br>from torch.utils.data import TensorDataset<br>import pandas as pd</pre><p>We have all of the necessary libraries for any machine learning project such as data loaders, torch, NumPy, and pandas. However, what is special is that from the <a href="https://huggingface.co/">Hugging Face Library,</a> here called transformers, we import the DistilBertTokenizer and the sequence classification BERT models. These are the pre-trained assets we are going to use.</p><h4>Data Cleaning</h4><p>Here we clean the data that come along with this dataset. Some examples of this the adding all of the columns such that they result in the output we want and dropping the unnecessary columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kczox2rR6JH3vqUEMxVZoA.png" /><figcaption>Before Cleaning</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SoMBvRQksE2s3LKzc-eh_Q.png" /><figcaption>After Cleaning</figcaption></figure><p>We repeat this process for the train, validation, and test datasets. From all of this, we are left with data that we can pass into our tokenizer.</p><h4>Tokenization and Data Loading</h4><p>We need to tokenize the words into numbers and I wrote a function for that purpose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ca4bade2c065ea15d7e92b968daa7e8/href">https://medium.com/media/1ca4bade2c065ea15d7e92b968daa7e8/href</a></iframe><p>This would then add to a list which then we can pass into the train function. But before that, we need to make this data into batches in order to make it train faster. This is done with data loading as seen below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9922c2fa05439554345c2c076b666324/href">https://medium.com/media/9922c2fa05439554345c2c076b666324/href</a></iframe><p>This is where we also define the batch size along with how the data will be organized. In this case, it’s just going to be sampled randomly.</p><h4>Training</h4><p>Now that we have it already let’s pass this into the train function. I am not going to put the train function because a) it’s not my work b) it’s really long. But if you still want to check it look <a href="https://colab.research.google.com/drive/1d0XNaWXKQjtz4zterP0Yg_RuLjdOhsNg#scrollTo=supHC-Sf4XMj">here </a>for the google collab link or here for <a href="https://gist.github.com/Sayeet/087c1eba973c12ddb754d71c6f3fff20">here</a>, just the train function in a GitHub gist.</p><h3>The End Product</h3><p>Check out this video on youtube for the project demo.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUAIHnJe0VSY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUAIHnJe0VSY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUAIHnJe0VSY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eb36ab3e54163d31139224eba5d2fc0/href">https://medium.com/media/0eb36ab3e54163d31139224eba5d2fc0/href</a></iframe><h3>Quick Links:</h3><p>Here is the link to the demo of the project:</p><p>Here is the link to the google colab version: <a href="https://colab.research.google.com/drive/1d0XNaWXKQjtz4zterP0Yg_RuLjdOhsNg?usp=sharing">https://colab.research.google.com/drive/1d0XNaWXKQjtz4zterP0Yg_RuLjdOhsNg?usp=sharing</a></p><p>Github Link: <a href="https://github.com/Sayeet/Multilingual-Hate-Speech-Detection">https://github.com/Sayeet/Multilingual-Hate-Speech-Detection</a></p><p>Here is the link to the corresponding article: <a href="https://medium.com/@ss_44790/how-to-stoping-hate-with-machine-learning-4e0277a98be3">https://medium.com/@ss_44790/how-to-stoping-hate-with-machine-learning-4e0277a98be3</a></p><p>Here is the link to the dataset: <a href="https://www.kaggle.com/ludovick/jigsawtanslatedgoogle">https://www.kaggle.com/ludovick/jigsawtanslatedgoogle</a></p><h3>If you have any questions please email me at ss@tambo.li.</h3><h3>Quick Note about Me🚀:</h3><p>I am a 9th grader that is interested in AI. I am constantly looking for new opportunities so feel free to contact me on <a href="https://www.linkedin.com/in/saeed-tamboli/">LinkedIn </a>or <a href="https://substack.com/profile/50498471-saeed-tamboli">subscribe to my newsletter!📰</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e0277a98be3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>