<?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 Vansh Sethi on Medium]]></title>
        <description><![CDATA[Stories by Vansh Sethi on Medium]]></description>
        <link>https://medium.com/@vanshsethi?source=rss-940f367dd4d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*H-SwwY3p5WJ01Irrd4zsTQ.jpeg</url>
            <title>Stories by Vansh Sethi on Medium</title>
            <link>https://medium.com/@vanshsethi?source=rss-940f367dd4d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:26:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vanshsethi/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[Epigenetic Topic Modelling of Oncogenes]]></title>
            <link>https://vanshsethi.medium.com/epigenetic-topic-modelling-of-oncogenes-df2664bc5d3d?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/df2664bc5d3d</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[cancer]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[genetics]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 20:24:31 GMT</pubDate>
            <atom:updated>2021-01-01T20:31:58.975Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70T3inpz6t6GToBvtnOYvQ.png" /></figure><h3><strong>Cancer is Inherently Linked to our Genetics</strong></h3><p>Cancer. Probably one of the most difficult problems that has faced humanity since it’s conception. Yet, it is still one of the most elusive diseases, where it’s hard to determine the biological mechanisms and reasons as to why it occurs. Recent advancements in biology and oncology has shown that cancer has definitive connections to our genetics, more specifically, our epigenetics, or the expression of certain genes in our bodies. Some genes within the body may be more expressive than others, or show more in the resulting phenotype then other genes, and this is widely determined by environmental factors such as one’s diet, physical environment, nutrition, heritage, etc. A common example of this is with smoking and lung cancer. Most people know that lung cancer can be attributed to smoking, and the usual explanation is that smoke directly damages cells within the lungs, however, this explanation can be extended further, where smoking may in fact also damage the expression of certain genes, and may allow cancerous genes, or oncogenes, to be expressed even more. Thus, it is known that epigenetics plays a role in the risk of cancer, and cancer susceptibility in a biological system.</p><p>But what does it really mean for a gene to be more expressive than another? If we look at the structure of genes, strands of genes are wound up around histones, which are proteins that allow the genes to be packaged into nucleosomes (essential for chromosomes). Depending on the structure of multiple histones, some DNA may be inaccessible to read, and thus, cannot be expressed within the body. The orientation and proximity of these histones are regulated by the histone tails, which are parts of histones that anchor out of the histone, and methyl groups, which are organic compounds that bind to these histone tails in order to make them tighter or looser. Generally, if methyl groups do not interact with the histone tails, then the histones will be closer, leading to less expression among genes. However, if methyl groups do interact, there will be more expression of certain genes. Since methyl groups are organic compounds, smoking may introduce more carbon and hydrogen into the body, leading to more expression of cancerous genes. As you may be able to see, the environment and what our body interacts with plays a huge role in our epigenetics, and the expression of genes within or body.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/0*x9qiLUjvXNkFgvKX" /></figure><p>The most ideal solution around regulating or epigenetics is to express the right genes would be to have ideal environments and situations. However, situations and environments vary all around the world, which makes it hard to implement a solution for limiting the expression of certain oncogenetics right now. Instead, epigenetic editing has been proposed, which involves targeting specific genes within the body and changing the orientation of the histones to which those genes are attached to. The major barrier for epigenetic editing is figuring out what genes need to be targeted (aka identifying oncogenes) and how to target them within our genetic makeup with absolute accuracy. This article hopes to address the first problem, using unsupervised machine learning, and a specific algorithm, Latent-Dirichlet Allocation to identify oncogenes when given samples of cancerous tissue and the gene expressions in those tissues.</p><h3><strong>Data: Cancerous Tissue Samples</strong></h3><p>The data for this project was gathered from <a href="https://www.cancer.gov/about-nci/organization/ccg/research/structural-genomics/tcga">The Cancer Genome Atlas</a> database, which includes various types of data around cancer and genetic makeup. Specifically, epigenetic data in breast cancer and lung cancer tissue samples were obtained. Each respective dataset came with around 200 samples, with 23000 genes and their expression value respectively within the sample. There are definitely more than 23000 genes in these samples, however the genes selected to be examined have expression values that are not negligible, as any value lower would not be impactful in the final phenotype of the sample. The expression value of a certain gene in the sample is a relative figure, where the magnitude of the number is determined by the expressions of other genes.</p><p>The task is to figure out which genes are likely to be oncogenetic, simply given their expression values in cancerous and non-cancerous tissue samples. Thus, this task does not have labelled data — which is the case for a lot of machine learning tasks — and instead is completely unlabelled (meaning that if a gene is cancerous or not is unknown). The Latent-Dirichlet Allocation (LDA) algorithm purpose is to group similar data together, that seem to have the same function in the dataset. Or in this case, to group genes that are oncogenetic and non-oncogenetic together. This algorithm is a clustering type of algorithm, and knowing this allows the data to be modelled in a way where this task can be performed.</p><p>Specifically, LDA is a type of NLP algorithm, where it mainly deals with textual information. More specifically, this algorithm can only deal with textual data, which is why the expression values and genes need to be represented together. In order to do this, for each tissue sample in the dataset, the expression values range was broken into 20 sections. Where an expression value of 0–1 may be in the first section, 1–2 may be the second section and so on. Then depending on the gene’s section relative to the other genes, the section number was appended to the end of the gene’s name. So say for example, the gene PRKCSH was expressed in a cancerous sample to a degree of 9.1. It is in the 18th section compared to the rest of the genes, so the final piece of data would be represented as PRKCSH-18. This tells you both its gene and relative expression value in a sample. The following code achieves the processing of the data:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69bc2d51826a1ae095f4aefb46df28d7/href">https://medium.com/media/69bc2d51826a1ae095f4aefb46df28d7/href</a></iframe><p>The data specifically entered into an LDA algorithm is a document-term frequency matrix. The document here refers to one tissue sample, and is represented as rows in the matrix. The terms are all the possible “words” that something can be in the dataset. For this use case, the term space is defined as all the genes and their possible suffixes. The terms are represented in the column of the matrix. The frequency simply tells you if a term occurs in a certain document. Or in this case, if a certain gene with an expression value occurs in a certain tissue sample. Here’s an example of what the document-term frequency matrix may look like for the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*6syMEtm1oV1K4k52" /></figure><h3><strong>Latent Dirichlet Allocation Algorithm</strong></h3><p>The purpose of this algorithm is to derive topics, or group genes with their respected expression values together in order to determine which genes cause lung cancer, which genes cause breast cancer and which genes are normal. This type of problem is known as a clustering problem, and it often requires algorithms that are generative. The Latent Dirichlet Allocation (LDA) algorithm is a sophisticated generative algorithm that is used to sort topics and documents together, and sort topics and words together. It does not require any predefined topics, instead it derives topics on its own and sorts genes into their corresponding topics (hence where latent comes from). LDA includes 4 parts, two dirichlet distributions and two multinomial distributions.</p><h4><em>Defining Key Terms</em></h4><p>In order to easily understand how LDA works and the purpose for this project, here are some key terms used:</p><p>Documents: A corpus of words (eg. My dogs are purple.)</p><p>Word / Term: An individual entity (eg. dogs)</p><p>Topic: A generalized set of words or documents (eg. Airplanes: flight, sky, travel)</p><h4><em>The Grand Idea of LDA</em></h4><p>The idea around LDA is to generate new documents, using a probabilistic model of our words found in a vocabulary, and compare the new generated document to the actual documents, and see if they compare well. The mechanism to do this is by creating topics, and using words in these topics to generate these new documents. By creating better documents that are comparable to real documents that we provide, we also get better topic models and better classifications of words, leading to a topic model.</p><p>There are 2 major assumptions that are made when performing topic modelling with LDA. The first assumption is that documents are made up of a mixture of topics. The second assumption is that certain words in the vocabulary can be sorted into topics probabilistically, meaning that each word has a certain probability for being in a certain topic (ex. 50% in topic 1, 20% topic 2, 30% topic 3). Based on these assumptions, new documents can be formed.</p><h4><em>Document Generation — Dirichlet Distributions and Multinomial Distributions</em></h4><p>This algorithm is a generative algorithm, meaning that produces outcomes and backtracks from those outcomes in order to find optimal solutions for the task at hand (as is the case for many deep learning algorithms). The LDA algorithm produces new documents by generating two dirichlet distributions and two multinomial distributions.</p><p>An LDA algorithm consists of two dirichlet distributions, where one distribution represents the relation of documents to each other depending on n topics and another distribution represents the relation of topics to each other based on m words. These distributions are usually represented as simplexes (triangles) in n dimensions, where n represents either the number of topics of the first distribution, or the number of words in the second distribution. Multinomial distributions are distributions derived from dirichlet distributions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*JwwMVXGLOzRd2Kbc" /></figure><p>Let’s take an example of dirichlet distributions and multinomial distributions for topic modelling on a vocabulary of 4 words and 3 topics. Here, 3 topics are defined, sports, science and politics. 4 words are defined, galaxy, planet and referendum. The job of the LDA algorithm is to figure out how documents are spread out among these topics, and how topics are spread among words, in order to create new documents that can be measured against real documents. This is done by using dirichlet distributions (image shown above) and by deriving multinomial distributions from these dirichlet distributions.</p><p>The left distribution in the image above represents the dirichlet distribution of documents among topics. We see that most documents are exactly in the corners, either being classified as totally science, sports or politics. However, there are 2 documents that are between two topics, one between science and sports and another between sports and politics. This goes back to the first assumption that was made for an LDA algorithm, that documents are mixtures of topics, and dirichlet distributions allows us to probabilistically determine their relations to certain topics. So the document in the middle-left of the dirichlet distribution may be 50% science and 50% sports. This is a multinomial distribution, which is simply a distribution of all the topics on a certain topic. This is important, as we can generate new documents based on these multinomial distributions. Therefore, the dirichlet distribution creates a multinomial distribution that further allows us to create new documents. Yes, it’s a distribution of distributions.</p><p>The other dirichlet distribution represents the distribution of topics among words in the vocabulary of the corpus. For each topic plotted in the distribution, we can see it’s relation to certain words, and how close it is probabilistically to a certain word. So for example, the blue topic is in between planet and galaxy, meaning that the topic has something to do with these two words, perhaps with space all together. By creating this distribution, much like the other distribution, we can probabilistically determine topics and their relation to certain words, and create multinomial distributions for each topic. For example, the multinomial distribution of the blue topic may be 50% planet and 50% galaxy in terms of its relation to words.</p><h4><em>Document Generation — Algorithm</em></h4><p>The algorithm for document generation uses the distributions that are created by the LDA algorithm, to generate new documents. It does so by the following process.</p><ol><li>Pick a number of words that you would like to generate.</li><li>Choose a random point on the document-topic dirichlet distribution.</li></ol><ul><li>For example, you may pick a point on the dirichlet distribution that represents a multinomial distribution of 30% science, and 70% sports.</li></ul><p>3. For each word, use the multinomial distribution that you got from the document-topic dirichlet distribution, in order to figure out which topic you will find a word for.</p><ul><li>For example, the document multinomial distribution might be 70% sports and 30% science. You pick randomly and 70% of the time you will find a word for sports, and 30% of the time, you will find a word for science. Here, it is more likely to find a word for sports.</li></ul><p>4. After randomly picking what topic to find a word for, you pick the point on the topic-word dirichlet distribution for that certain topic.</p><ul><li>For example, you may pick a point on the distribution that represents the multinomial distribution of the topic sports.</li></ul><p>5. Using the word multinomial distribution, generate a word for the new document</p><ul><li>The multinomial distribution for the topic of science may be 30% football, 50% basketball and 20% soccer. We might generate the word “basketball” on the first try.</li></ul><p>6. After repeating this process of generating words for some certain amount of words we are looking for, we put them all together to create our final document. This document is then compared to real documents in the dataset, and by comparison, we tweak our distributions to generate more similar documents.</p><p>After generation, the goal is to create even better dirichlet distributions that can lead to better document generation. As you may see, by doing this, we also get better probabilistic models for our topics, or lead to topic modelling. The way we create better dirichlet distributions is by tweaking the distributions until we numerically get better documents. The way we numerically measure how good our model is performing is by using the following equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sk9eb8_jXFSwqQbN" /></figure><p>It looks complicated, but in essence it’s the product of 4 probabilities, where each probability merely represents the probability that the distribution that the probability is representing is accurate. It measures this via comparison of multiple models. There are four probabilities, 2 for the 2 dirichlet distributions, and 2 for the 2 multinomial distributions. The product of these distributions finally gives us the accuracy of the document compared to a real document. We then tweak the model from here using methods such as <a href="https://towardsdatascience.com/gibbs-sampling-8e4844560ae5">Gibbs Sampling</a>, or trial-and-error.</p><h4><em>Applying LDA to Epigenetic Topic Modelling</em></h4><p>As you may be able to see, LDA is a powerful algorithm because it can derive structure from inherently unstructured data. This is fundamentally why it was used for this project, in order to greatly increase the accuracy of the topics found.</p><p>For the specific LDA algorithm used, a couple of hyper parameters were set. The number of topics to be generated was set to 20, and the number of words to be sampled for the document generation phase was the average of genes in each sample of tissue. This is because the quantity of sample measured to determine the epigenetics of the sample was held constant for the dataset. Therefore, the average is needed to emulate the creation of new samples as precisely as possible. The final vocabulary size of the task was determined to be 200000. Gibbs Sampling was used to generativity and iterative build better models and distributions, using Gensim, a popular Python framework for language models. The following code represents the creation of the documents for the task and the training of the LDA model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51a0e8f12d4d86b0952d8cbe402cf192/href">https://medium.com/media/51a0e8f12d4d86b0952d8cbe402cf192/href</a></iframe><h3><strong>Results</strong></h3><p>The final topic-word dirichlet distribution is shown below, as well as the final topics derived.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_WNbHXH2WgmkCmEb" /></figure><p><em>Interactive Results: </em><a href="https://vansh-sethi.github.io/Topic-Modelling-Cancerous-Genes/ldaResults"><em>https://vansh-sethi.github.io/Topic-Modelling-Cancerous-Genes/ldaResults</em></a></p><p>A couple of key results were obtained after the topic modelling. The first major results was the accurate modelling of oncogenetics and normal genes. Three major groups of genetic topics were compartmentalized, with topic 1 and 2 representing lung and breast cancer oncogenes respectively and topic 3 representing normal genes. The accuracy of the results are further validated since 20 topics were set to be derived, and 3 major topics still were derived nonetheless. The rest of the topics were set to not be important, since the algorithm only needed to accurately model 3. Furthermore, there is inherent overlap between the lung cancer and breast cancer oncogenetics, further showing some oncogenes have dual consequences when it comes to cancer proliferation. This is significant, as now certain genes may be identified that may cause both, such as the FN1 gene and ISLR gene. The last key result was that some oncogenes may cause cancer proliferation when they are not expressed. Most oncogenes proliferate cancer when there is a large expression value, however oncogenes such as TRPM3 and GRIN2B proliferate cancer when they are not expressed. This shows the role of certain genes where they need to be expressed within the system to lead to a desired result of non-cancerous tissue. It’s also important to note that this phenomenon was noted substantially more in the breast cancer tissue over the lung cancer tissue.</p><p>The last major advantage of using LDA is that it allows us to measure probabilistically the potency of a certain oncogene and its role in cancer, where some oncogenes may cause more proliferation and others cause less. This is inherently important as oncogenes that probabilistically have a higher chance of proliferating cancer may be targeted first and help solve more cases.</p><p>Conclusively, we have identified a number of oncogenes and their role in respective cancers.</p><h3><strong>Limitations and Future Steps</strong></h3><p>By far, the biggest limitation of the LDA topic model is that it does not provide biological mechanisms to as specifically why certain oncogenes proliferate cancer more than others. However, these results may be used in order to filter out certain oncogenes and further allow specific experimentation with those oncogenes.</p><p>The model does not also filter in why the genes were expressed in a certain way, which would have been useful for delivering actionable insights to the general public when it comes to mitigating cancer. The element of causation for a future LDA topic-model may be used in order to determine how certain environmental factors play varying degrees of roles in cancer proliferation.</p><p>Lastly, the following results may be used in conjunction with epigenome editing, a mechanism to change our epigenetics. Certain key oncogenes were identified as proliferating more than others, and this knowledge may be used to target certain resulting oncogenes in our epigenome.</p><h3>Links + Resources</h3><p>Results: <a href="https://vansh-sethi.github.io/Topic-Modelling-Cancerous-Genes/ldaResults#topic=0&amp;lambda=1&amp;term=">https://vansh-sethi.github.io/Topic-Modelling-Cancerous-Genes/ldaResults</a></p><p>Methodology for LDA algorithm based off of the following paper: <a href="https://corescholar.libraries.wright.edu/cgi/viewcontent.cgi?article=2515&amp;context=knoesis">https://corescholar.libraries.wright.edu/cgi/viewcontent.cgi?article=2515&amp;context=knoesis</a></p><p>Code + Data: <a href="https://github.com/Vansh-Sethi/Topic-Modelling-Cancerous-Genes">https://github.com/Vansh-Sethi/Topic-Modelling-Cancerous-Genes</a></p><p>The results here are in whole or part based upon data generated by the TCGA Research Network: <a href="https://www.cancer.gov/tcga">https://www.cancer.gov/tcga</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df2664bc5d3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Dive into Blockchain]]></title>
            <link>https://medium.com/data-science/a-deep-dive-into-blockchain-d1eb753fb74c?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1eb753fb74c</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cool]]></category>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sat, 18 Apr 2020 18:47:47 GMT</pubDate>
            <atom:updated>2020-04-19T16:13:14.803Z</atom:updated>
            <content:encoded><![CDATA[<h4>Everything you need to know about this growing technology</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*itiloJMcjc3ZobFBg_lSRg.png" /></figure><h3><strong>Do You Trust Me? 😈</strong></h3><p>Our entire society runs on trust. You trust your boss to pay you. You trust the government to ensure your security. You trust your bank to not steal your money and run away. <strong>We blindly trust so many institutions and people without giving it a second thought.</strong></p><p>But what if something happens? Your boss doesn’t pay you. The government falls. Your bank invests all your money into the stock market and the stock market crashes, leading you to lose all your savings (Ahem… Stock Market Crash of 2008). It seems impossible that these horrible things could happen. But the fact is, trust is the only thing that holds up these systems. Trust makes you vulnerable and susceptible to damage, but you depend on these systems. You have to trust governments, banks and institutions because there is no alternative. Well, there hasn’t been an alternative until <strong>Blockchain, which aims to create a no-trust dependent system.</strong> So you don’t have to trust that your bank will run away with your money. You don’t have to trust that your government will fall.</p><p>You might be asking yourself, ‘Blockchain seems amazing! How does it work?’ And it is truly amazing, but <strong>to get a deep understanding of how blockchain works and is used to disrupt current systems, you first have to understand how current institutions function.</strong></p><h3><strong>The Issues with Centralization 🌐</strong></h3><p>Imagine you wanted to send money to your friend on the other side of the world. You wouldn’t mail them a cheque or send them physical cash. That would take too long. Instead, you would send money through Paypal or your bank’s e-transfer system. Fast and easily accessible… right? Wrong. Your bank needs to validate that the money coming from the account is you and you authorized the payment. Then, they need to verify that you’re sending the money to a trusted source, which probably had to be authorized beforehand by you. But before you know it, your friend just received $100 while you paid an extra $10 processing fee.</p><p>The idea of a bank or an institution facilitating transfer is the idea of centralization. Everything goes through them and everything comes out on either side. They see everything and no one can access your files. For the most part, this system works and we heavily depend on it as a society. But, there are a couple of issues that come up.</p><p>Vulnerability — Since everything is hidden and cataloged in a ‘secure’ database, it makes everyone&#39;s’ info vulnerable. <strong>It would only take one database leak for all your credit card details to be leaked.</strong> We see this time and time again when big companies suddenly get hacked. It’s happened to eBay, Adobe, Canva and other big notable companies.</p><p>Fees and Financial Incentive — Like any other company, institutions that facilitate transfers want to make money. They usually do this by<strong> adding a processing fee to their service</strong>. You don’t really have a choice as you might rely on some of these institutions.</p><p>Power Instability — If only a handful companies facilitate all the transfers that our society needs, then it <strong>gives those companies a large amount of power.</strong> They can create changes to the system that could have indescribable effects. Now the likelihood of your bank changing up the system is very rare. It’s the fact they have the ability to do so which is so scary. They can leverage their position, which has been done before.</p><p>Slow Implementation — If there is a part of the company’s service that negatively impacts a part of the population, chances are that <strong>it’ll take months at best to fix the problem.</strong> This is because of the long drawn-out process of bureaucracy within big companies. Major changes take a long time, which really hurts those that need immediate change.</p><p>All, and I mean ALL these problems are solved with the idea of blockchain. As you’ve probably guessed it,<strong> blockchain runs on the opposite of a centralized system. Blockchains are decentralized</strong>, with many properties that make it very favorable to people. Here’s how blockchain works.</p><h3><strong>The Basics of Blockchain: a New Take on Transfer 💻</strong></h3><p>A blockchain is a decentralized peer-to-peer system of transfer. No one controls the blockchain yet it runs indefinitely. How can something be decentralized? It means that everyone helps to run the blockchain. You technically make up the blockchain. Blockchain runs on a singular concept, a block in which these blocks are chained together, hence blockchain.</p><h4><em>Block + Chain:</em></h4><p>A block stores a piece of information or data within it. These could be transactions, information or anything. The block is associated with a hash, which is a unique string of characters created by a special cryptographic function. Each hash is unique and is kind of like the id of the block. Each block also contains the hash of the previous block, which is where the idea of being chained together comes. Each block references the last hash and so on.</p><h4><em>How Blocks are Created:</em></h4><p>A block needs to be verified before it’s added to the current blockchain. The transactions need to be verified and to make sure that everything checks out. The way this is usually done is through proof-of-work. People need to verify that the block is legit by solving a really hard math question, usually done with a computer. But who would want to give up their precious computer power to create a new block? The incentive is usually that the blockchain will reward the user that verifies the block with a small amount of money. This is how bitcoin and ethereum work, and people that verify these blocks are called miners. They are called miners because they are mining for this money via their computer power. Most people first hear about blockchain and the concept through the concept of mining, yet it can be misleading. I’ll talk more about mining later in the article.</p><h4><em>The Public Ledger:</em></h4><p>The blockchain is accessible to anyone and anyone is able to look at any certain block. This transparency is what makes blockchain so different from a normal centralized system. In a centralized system, only the company or institution has access to the ledger. By making the ledger public, it allows everyone to monitor the health of the chain and see if anyone is trying to do anything shady.</p><h4><em>Hash Dependency:</em></h4><p>It’s important to understand that the hash is dependent on the contents of a block. The slightest change of the contents can drastically change the hash. Because of this dependency property and the fact that everyone has access to view the blockchain, it makes the system unhackable. This is because if someone were to change the contents of a block for their own favour, it would change the hash and the block in front of it wouldn’t match the same hash. This way, the blockchain can easily recognize changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*bUF7qdh7HIyvtKUR" /></figure><h4><em>What Data Can Blocks Hold?</em></h4><p>The idea is that anything can be embedded into these blocks. The biggest example is the transfer of money, in which a block holds the information that shows a transfer of money between users. But even cooler applications include proofs of realty, proofs of certain items and even pharmaceuticals.</p><h4><em>Runs by itself via protocol:</em></h4><p>Once the blockchain has started, it runs by itself forever. It doesn’t need anyone to watch over it. If it has enough miners and transactions, it’ll continue to work. This is because it’s run by a protocol and essentially lives on everyone’s computer. Unless the internet itself dies, then the blockchain will too.</p><p>Those are the basic properties of every blockchain. But as technology evolves, new properties will emerge…</p><h3><strong>Extra (But Useful) Properties of Blockchains ✔️</strong></h3><p>If the bare minimum requirements of a blockchain can be fulfilled, then anything extra can be added on. Many big blockchain companies create cool features to get more people using their blockchain. Some notable extra properties of blockchain include:</p><h4><em>Smart Contracts:</em></h4><p>Probably one of the most popular features of a blockchain, smart contracts allow for virtually anything to be traded among people. It’s essentially just like a real contract yet is enforced by a protocol and once created, irreversible. It outlines requirements in which the protocol will verify and facilitates trade between two parties. For example, if I want to create a smart contract that pays me for every hour of work I give to my employer, my employer and I can create a smart contract and use sensors to track my hours. For every hour I do, the protocol will automatically take X amount of dollars from his account and put it into mine. Smart contracts can do so many things which is why they are so cool.</p><h4><em>Forking:</em></h4><p>Blockchains aren’t completely secure. Sometimes, a hacker will get your account details on a blockchain and steal all your stuff. It happens, but it’s usually the fault of the owner of the account. It’s usually only a small amount of money, but if a hacker steals millions of dollars, that would be horrible. Thankfully, there’s a way to retrieve the money. Forking the blockchain means to go back to a certain point in time to a certain block and restart everything from that block. It would essentially be like nothing ever happened. But forking can only occur when 51% (or a majority) of the users on a blockchain want to fork. This puts the power of the blockchain in the hands of the collective, making it a more democratized system.</p><h4><em>Price Stability:</em></h4><p>Some blockchains with currencies are experimenting with a price stability system, which essentially means that the value of their coin is constant. Companies do this by creating a protocol that matches the amount of coins in circulation and holds it in a private bank account. Any time the coin grows in value, they can instantly add more coins and vice versa. The USD coin is based on the American dollar and is always valued at $1 USD. This makes cryptocurrencies more reliable and easy to use.</p><h4>Varying Degrees of Decentralization:</h4><p>Many companies are creating blockchains that have lower levels of decentralization and are more centralized. For example, they might have all the basic blockchain properties except for a public ledger, making it more of a centralized system. Sometimes, a blockchain with more centralization can be better, depending on what the blockchain is used for.</p><h4><em>Types of Blockchain:</em></h4><p>There are 3 types of blockchain that all have their distinct advantages and disadvantages. The 3 types of blockchains are: public, private and consortium. They all work in various ways but are more or less still decentralized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1V13znGJzc5_mo7y" /></figure><p>There’s a ton more, but these are some of the most notable ones.</p><h3><strong>Applications of Blockchain </strong>📝</h3><p>The applications of blockchains are endless. It can be used for almost anything. Here are some of the applications of blockchain that come to mind and are the coolest.</p><h4><em>Cryptocurrencies</em></h4><p>I can’t write an article about blockchain without mentioning cryptocurrencies. The first-ever blockchain was based on a cryptocurrency and is the most famous blockchain of all of them, Bitcoin. A cryptocurrency is a currency that can be traded over a blockchain, peer-to-peer. It uses all the fundamentals of blockchain and theoretically is the easiest blockchain to create. There are over thousands of cryptocurrencies.</p><h4><em>SolarCoin</em></h4><p>SolarCoin is an energy trading blockchain with a currency. People can trade the energy they have in return for someone else’s solar coin, based on an agreed price. It uses smart contracts to facilitate trade.</p><h4><em>Item Validation</em></h4><p>Proof of ownership is also another exciting way blockchains are being used. People can own id’s that verify a certain item. It can represent a piece of jewelry or even a deed of a house. These id’s can be traded among people and subsequently the item itself.</p><h4><em>Wifi Sharing</em></h4><p>Companies like HotSpot and Helium are creating blockchains where people can share wifi in exchange for money. The rates are typically lower and it uses smart contracts when applicable.</p><h3><strong>Challenges of Blockchain (and the Solutions)</strong></h3><p>Even though blockchain technology can be used for some really cool applications, there are still a variety of things that inhibit blockchain from being the best alternative out there.</p><h4><em>Speed</em></h4><p>Blockchains are notoriously slow when it comes to facilitating trade between users. The average time it takes to transfer money on bitcoin takes around 10 minutes per transaction. This is incredibly slow considering the time it takes centralized banks to do the same thing.</p><p>The solution to this problem is creating a lighting network between users. If two users agree that they are both trustworthy, they can create a direct link between themselves and transfer without having the blockchain needing to verify. Bitcoin has started to implement something like this.</p><h4><em>Memory Issues</em></h4><p>Storing all the information about transactions takes up a lot of data and space. If everyone needs to have a copy of the blockchain, then it makes it infeasible to use the protocol.</p><p>The solution is automatically deleting the oldest part of the chain after X amount of years. This way, the chain can always have a fixed length and will run indefinitely.</p><h4><em>Illegal Uses</em></h4><p>Since lots of blockchains are anonymous, many people use cryptocurrencies and blockchains as a way to transfer money for illegal items. The dark web exclusively uses blockchain for their transactions</p><p>The solution to this is to create blockchains that aren’t anonymous. These would be considered private chains and would lead to more transparency.</p><h4>Inefficient Use of Power</h4><p>When everyone is trying to solve a cryptographic hash function when mining, sometimes multiple users will try to solve the same function, leading to an inefficient use of power.</p><p>The solution to this is to create a new protocol for mining. The proof-of-stake protocol has been proposed, where people bid coins (but don’t actually lose it) to mine a certain block.</p><h3>Key Takeaways</h3><ul><li>Blockchains are a decentralized system whereas most institutions are centralized</li><li>Blockchains are made up of blocks which contain data and are linked together</li><li>Hash functions are used to encrypt blocks</li><li>Blockchains can be used to transfer items between two or more parties</li><li>There are many challenges that blockchains face, yet there are new innovative solutions that are making the technology more feasible.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1eb753fb74c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/a-deep-dive-into-blockchain-d1eb753fb74c">A Deep Dive into Blockchain</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Truth About Complacency]]></title>
            <link>https://medium.com/swlh/the-truth-about-complacency-6171fa2cd1b8?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6171fa2cd1b8</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[lessons-learned]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[growth]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sat, 11 Apr 2020 16:45:31 GMT</pubDate>
            <atom:updated>2020-04-11T16:45:31.923Z</atom:updated>
            <content:encoded><![CDATA[<h4>Everything about complacency and why it’s crippling you from the inside.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pbA6BZwfy9kDGMGLihOheg.png" /></figure><h3><strong>Feeling satisfied? 🤔</strong></h3><p>Imagine this. You’ve just finished an enormous project that took you over 100+ hours of work and over 4 months to complete. You’re tired, and rightfully so. You decide a vacation is in order and take a 2 week break and just relax. Afterwards, you’re feeling satisfied with your situation and just go back to doing the same kind of stuff. You don’t want more because you’re happy with what you’ve got. <strong><em>So, what’s the issue? </em></strong>You decide that you don’t need to spend more time on harder projects, because you’ve already <strong>proven yourself </strong>and you’re good to spend a couple of months chilling. After a few months, you fail to find the motivation to do anymore work, and you find yourself in a slump. What happened? You were able to do so much and used to be excited to work on cool things. <strong>Complacency happened. </strong>You felt too satisfied and didn’t continue your momentum.</p><p>A dictionary definition of complacency is as follows:</p><blockquote>a feeling of smug or uncritical satisfaction with oneself or one’s achievements.</blockquote><p>But complacency is much more than that. <strong>It means to not have aspirations or to be critical of the things around you.</strong> In this article, I’ll explain how to tell if you’re being complacent, why being complacent stifles innovations, how to rectify complacency and how you can use this anti-mindset to change the world.</p><h3><strong>First of all… complacency ≠ taking a break ❌</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*qxv2uLXQeKPuLwpw" /></figure><p>I’d like to distinguish the fact that being complacent is not the same thing as taking a break. If you’ve worked hard, you should reward yourself and relax. Avoid burnout, as that is one of the worst things that can happen to you. You want to ensure that your physical and mental health is assured. So generally, take breaks but don’t get used to it.</p><p>To ensure that you don’t start becoming complacent after taking a prolonged break, make sure that your motivations are in check. If you really want to continue and disrupt whatever you’re passionate about, you will keep going. You’ll know when you’re complacent when you feel you don’t want to continue to work on or continue to instruct change in an industry. It’ll happen when you start accepting the way things are and just accept the conventional norms.</p><p>Complacency can also be attributed to irritation. If you get irritated by change very easily, you are indefinitely complacent. But being complacent about something is also very good. For example, you should be complacent about how we treat criminals in a criminal court (in a western liberal democracy). So complacent is okay in some sense but is much different then a break.</p><h3><strong>Why complacency stifles innovation </strong>💻</h3><p>Think about the heavy hitter disruptors in our society. Elon Musk, Larry Page, Jeff Bezos, Peter Thiel and you get the idea. All these disruptors practice anti-complacency and is a reason for why they are so successful and made a big impact on the world already. They don’t accept the status quo and decide that they want to change it to how they see fit. They are relentless in the pursuit of change.</p><p>If we were all complacent, we would all live much simpler lives. There would fundamentally be less innovation. This is because everyone would be satisfied with the current situation and not wanting to actually change via innovation. We wouldn’t have Elon Musks or Larry Pages.</p><p>If all billionaires are really keen on not being complacent, then I think there’s a definitive trend going on. There’s a reason to not be complacent, but how do you or I achieve that?</p><h3><strong>Signs that you’ve become complacent⚠️</strong></h3><p>Here are a few ways to tell if you’ve become complacent:</p><ul><li>You live in a constant routine</li><li>You are satisfied with the things around you (but not necessarily happy)</li><li>You never think about innovative ideas</li><li>You don’t care too much about anything</li><li>Just want to constantly relax and chill</li></ul><p>Usually you’ll know you’re complacent when you have little to no ambition to better yourself or work on major projects. This is bad as you aren’t capitalizing on your full potential. So how do you fight complacency?</p><h3><strong>How to fight complacency 🥊</strong></h3><p>The only way to fight complacency is to have the drive to better yourself everyday. And the only realistic way to achieve this is to understand yourself on the most basic level. We can use first principles thinking as a framework to understand why we do things. Ask yourself what drives you to get out of bed every morning. Is it because you are feeling pressured by others around you? Or is it because you desire status? Or is it because you desire to help the less fortunate?</p><p>What pushes you to do things and motivates you should not be for selfish reasons. I give the examples of billionaires again. Most billionaires (~99%) do things because they aspire to help those around them. Elon Musk runs a space company because he wants to push humanity’s limits. If you have a genuine motive to do something, then being anti-complacent will be super easy for you.</p><p>I’ve talked a lot about how to not be complacent about your own life. But there’s also complacency in accepting the conventions that our society runs by. You probably never notice why you have to take a highway for over 1+ hours a day just to get to work. You never notice the environmental implications of water bottle companies. You never notice these things because you’re too complacent.</p><p>Billionaires aren’t only complacent in their own lives but question everything around them. You should do the same. Next time you think about anything, ask yourself ‘why does it work like this?’ or ‘is there a better alternative?’. That’s how industries are disrupted, by people questioning how they currently work. That’s how the computer was built, how cars were built, how rockets were built and you get the idea.</p><p>Above all, anti-complacency is a muscle that you need to build. You need to constantly remind yourself about being intentional about anti-complacency. The more you remind yourself about it and practice it, the more it becomes routine and you naturally disrupt everything around you. A way to practice this is to have actionable goals like “think about why x works like this” or “can I do this in a better way.”</p><h3><strong>Benefits of anti-complacency ✔️</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*XNFIx7jEuww13ILg.jpg" /><figcaption>Living your best life</figcaption></figure><p>The benefits of anti-complacency should have become more apparent throughout this article. But to summarize the tangible benefits of complacency, they are as follows:</p><ul><li>Can have a greater positive impact on the world</li><li>Can increase your potential to grow and grow even more</li><li>Can be more happier because working on things you care about</li><li>Understand yourself better</li><li>Get the most out of life</li></ul><p>Practicing anti-complacency will change your life and provide so many tangible impacts. There’s virtually no reason not to be anti-complacent. The future unicorns and people that impact this world are all going to be people that naturally practice anti-complacency, so the question becomes: Will you finally stop being satisfied?</p><blockquote><em>On a More Personal Note</em></blockquote><blockquote><em>Thank you so much for reading this article. I’m constantly exploring machine learning topics and creating projects centered around practical uses of the technology. Check out my personal website for more! </em><a href="https://vanshs.com/"><em>Click Here!</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6171fa2cd1b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/the-truth-about-complacency-6171fa2cd1b8">The Truth About Complacency</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[T-Cell Receptor Sequencing using Neural Networks]]></title>
            <link>https://vanshsethi.medium.com/t-cell-receptor-sequencing-using-neural-networks-9199a957f728?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9199a957f728</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[medicine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 19:35:43 GMT</pubDate>
            <atom:updated>2020-06-15T16:40:38.432Z</atom:updated>
            <content:encoded><![CDATA[<h4>Helping to eradicate diseases and viruses through the power of T-cells.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*neqw75MnpD3AEqRygH5hoQ.png" /></figure><h3><strong>The Greatest Threat to Humanity…</strong></h3><p>What is the greatest threat to humanity? Some might say that it’s a nuclear fallout. Others might say it’s the threat of a large asteroid hitting our planet. In fact, most people believe that the biggest threat to humanity is some out of this world, unimaginable thing that will wipe out humans in one sweep. Well… the greatest threat to humanity is right under our noses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*HZQ65R8qW7uPxB2a.jpg" /><figcaption>Nuclear Fallout is Unlikely</figcaption></figure><p>The greatest threat to humanity is a pandemic that could ravage around the world that we aren’t prepared for. Don’t believe me? Just look at what has happened in the past historically. The Spanish Flu inflected a quarter of the world’s population and killed upwards of 100 million people. Smallpox killed around 500 million people. Disease is the leading cause of death. Even billionaire philanthropist Bill Gates believes that the next worst thing to happen to humanity will be a virus.</p><blockquote><em>“If anything kills over 10 million people in the next few decades, it’s most likely to be a highly infectious virus rather than a war — not missiles, but microbes”</em></blockquote><p>Most of these viruses attack our immune system and terrorize our bodies from the inside. Fundamentally, we have been building vaccines as the main method of our attack to fight against these viruses. The way these vaccines work is that we inject the proteins of the virus into a person’s immune system to expose the immune system on how to fight against these viruses.</p><p>The fact is creating a vaccine is costly and takes a lot of time to create. Instead of having to expose the virus in a controlled matter to our immune system, what if we could probe our immune system to fight off these diseases without the use of a vaccine?</p><h3><strong>Welcome to T-Cells</strong></h3><p>T-cells are the immune system’s natural defense against disease. They are cells within the immune system that identify dangerous cells (like cancer or viruses) and deactivate those cells via apoptosis. Here’s how they work:</p><p>Every diseased cell has antigens on its surface which are cultivated from the cell hijacking other cells and doing damage to other cells. T-Cells have receptors (TCRs) on the surface of their cell which can bind to certain antigens, which allow the T-cell to kill off the diseased cell. Your body does this all the time with diseases, however, sometimes foreign diseases adapt to your body’s natural TCRs which make it so they can’t bind with the diseased antigens. This becomes problematic as the diseased cell can spread throughout your body and essentially kill you. CAR T-cell therapies solve this issue by engineering specific TCRs to fight these antigens.</p><h4><strong>Car T-Cell Therapies</strong></h4><p>In a CAR T-cell therapy, a patient’s T-cells are extracted from a blood sample and genetic information is injected into the nucleus of the T-Cell to instruct the cell to produce certain T-cell receptors. These new CAR T-cells are then put back into the body to bind with the antigens to kill diseased cells.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*ogARkcNALfyCXIpvevniww.png" /></figure><p>When considering the TCR of the new T-Cell, there are a few major parts of the receptor to engineer to make sure that the antigen can bind with the TCR. The major parts include:</p><p><strong><em>The Antigen: </em></strong>Also referred to as the peptide, this protein sequence is what connects the TCR to the MHC (or connector to cell) to allow for apoptosis to occur.</p><p><strong><em>V-Segment: </em></strong>The V-segment or variable-segment is a part of the T-cell receptor and is the most physically outside part. There are many different variants of the v-segment.</p><p><strong><em>J-Segment: </em></strong>The J-segment or joining-segment is what connects the v-segment to the rest of the TCR. There are many different variants of the j-segment.</p><p><strong><em>CDR3: </em></strong>The 3rd complementarity-determining region of the T-cell is also important when fighting diseases. It’s in the form of a protein sequence.</p><p><strong><em>Epitope: </em></strong>The epitope is what joins the antigen to the antibody or the rest of the cell. It’s represented in the form of a sequence of proteins.</p><p>Finding the parts of the T-Cell receptor is called <strong>T-Cell Receptor Sequencing</strong> or TCR sequencing. Currently, finding the various parts of the TCR require lots of research and tests. It can be costly and timely, not ideal when dealing with a new disease. This is where CAR T-cell therapies become inefficient for new diseases. T-cell receptor sequencing is a hard process that equates many variables and is hard to do currently. <strong>I introduce a deep learning method to TCR sequencing, using a variety of deep learning methods.</strong></p><h3><strong>T-Cell Receptor Sequencing with Machine Learning</strong></h3><p><strong>Given the epitope protein sequence of an antigen, can we predict the V-Segment, J-Segment and CDR3 Protein sequence of the TCR that will bind with the antigen?</strong> This is the fundamental question I tried to answer using machine learning. To make this easier, I broke up the problem into three manageable goals. The first goal is to create a model to predict the V-segment, one model to predict the J-segment and one model to predict the CDR3 sequence.</p><p>I used the VDJdb database which contains information on epitopes and their corresponding T-cell parts that would trigger apoptosis. It contains over 75,000+ data points which is what the model was trained on. You can find the database <a href="https://vdjdb.cdr3.net/search">here</a>.</p><h3><strong>Deep Learning Model for V-Segment and J-Segment</strong></h3><p>The method for predicting the v-segment and j-segment are very similar because they are only a handful of classes that the segments can be and a model can be tuned to predict the class that the segment is. <strong>This is a multiclass classification problem.</strong></p><h4><em>Input Data Representation</em></h4><p>As mentioned, the input of the <a href="http://becominghuman.ai/">neural networks</a> are the epitope protein sequence of the antigen. However, the epitope protein sequence is represented as letters in a non-fixed length. This is problematic as neural networks only work exclusively with numerical values in a constant size input matter.</p><blockquote><em>Examples of epitope protein sequences: LLWNGPMAV (Yellow Fever Virus), CPSQEPMSIYVY (Cytomegalovirus), CTPYDINQM (Simian Immunodeficiency Virus)</em></blockquote><p>Luckily, assigning each letter to an id makes this easier. We can map each letter in the protein sequence to a number. For example, the letter “A” becomes 1, the letter “B” becomes 2 and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*CAbbXJt59qlWWyFc" /></figure><p>So the yellow fever virus sequence becomes:</p><blockquote>LLWNGPMAV → 12 12 23 14 7 16 13 1 22</blockquote><p>This new encoded sequence of numbers has a length of 9. However, some sequences will have a length of 8, 10, 11 or up to 20 proteins. The input for a neural network needs a fixed-sized input, so to achieve this, we can pad every sequence to the max length possible of 20 with 0’s. So for our currently encoded protein sequence of the yellow fever virus, it becomes:</p><blockquote>12 12 23 14 7 16 13 1 22 → 12 12 23 14 7 16 13 1 22 0 0 0 0 0 0 0 0 0 0 0</blockquote><p>These inputs are fed into our neural network in the form of arrays. So with the input handled, how does the neural network decide which segment is appropriate for the sequence?</p><h4><em>Model Architecture</em></h4><p>A neural network is just a mathematical function that takes in input “x” and produces an output “y”. It has weights or learnt parameters that alter the x to get the y. There are different methodologies in <a href="http://becominghuman.ai/">neural networks</a> that utilize parameters in different ways. These parameters are optimized to produce the best output possible. This is done by calculating a loss function which represents how good the model is. The lower the loss, the better the model. We can use an optimizer (which are calculus functions) to optimize the loss and make it lower. This process is called “machine learning” &amp; “training the model.”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3cd0bb26a787e026535fcab17d08712/href">https://medium.com/media/f3cd0bb26a787e026535fcab17d08712/href</a></iframe><p>The model has over 30 million parameters that can be optimized. It has standard dense layers that perform the most basic neural network operations on an input yet is very effective.</p><h4><em>Output Data</em></h4><p>The last dense layer in the neural network has 126 neutrons which represent the 126 classes the V-segment of the T-Cell can be. The output is in the form of a one-hot vector which means every neuron output is 0 except for one of the neurons which is 1. The one neuron’s position that has a value of 1 determines which class the V-segment is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*u9PHqpl5zp3KP2le" /></figure><p>For the J-segment model, there were 68 neurons that represent the 68 classes the J-segment can be. It’s the same model with just a different number of classes in the last dense layer.</p><p>So for example, if we were predicting the V-segment class, if the output of the model is 1 0 0 0…. it means that the V-segment would be the 1st class or the TRBV6–8 variable segment.</p><h4><em>Training / Results</em></h4><p>After training both models, similar results were achieved. The loss went down to 3 for the entire dataset yet the validation loss was much worse. The model had a tough time generalizing on new data yet it works in theory. This is because many classes will work for a certain epitope so the loss in practicality is much lower.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*7PFvseH_1_C3mxTR" /><figcaption>Loss for V-segment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*iynn486k5ls-vzZT" /><figcaption>Loss for J-segment</figcaption></figure><p>After training for 30 epochs each, the model works decently well on new unseen data. I can predict one of the right classes up to 80% of the time.</p><h3><strong>Sequence 2 Sequence for CDR3 Protein Sequence</strong></h3><p>Since the CDR3 part of the T-cell is a protein sequence of a non-fixed length, a multiclass approach wouldn’t work. Instead, a new approach that takes in the epitope and produces an output of a dynamic length is needed. A Sequence 2 Sequence model can be used for this. It takes in a sequence (epitope protein sequence) and produces another sequence (cdr3 protein sequence). It incorporates an encoder-decoder model.</p><h4><em>Input Data Representation</em></h4><p>The way we represent the data for this model’s input is similar to the V-segment and J-segment models. The proteins in a sequence are mapped to a number. “A” is mapped to 1, “B” is mapped to 2 and so on. Yet, where the model’s input differs is that after encoding the proteins to numbers, those numbers are encoded into a one-hot vector. A one-hot vector is an array of 0’s with one number in the array as a 1. The position of the 1 in the array represents the class of that one-hot vector. For example, if the number 1 is encoded into a one-hot vector, the first position of the array would be 1 and the rest of the numbers would be 0. Since there are characters, there are 26 classes in the one-hot vector. Doing this allows for information to be handled easier through this neural network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*oBdgn1e4ITC7wHPx" /></figure><p>Also, at the beginning of the protein sequence and end, there will be a start and end token. These tokens essentially represent what they sound like, they indicate when a sequence is starting or when a sequence is ended. Also, the desired output will also be used during training explicitly within the model. I know, using the output for input? Yes, because it allows the seq2seq model to become more accurate and better.</p><h4><em>Model Architecture</em></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5ff2f9120f2d105d3dd5403289e23b8/href">https://medium.com/media/a5ff2f9120f2d105d3dd5403289e23b8/href</a></iframe><p><strong><em>Embeddings: </em></strong>First, the input is put through an embedding layer, which essentially converts it into a new vector of values of a fixed length. This is important as we had to pad our input to keep it to a constant length and this process allows us to make the padded areas unimportant. It multiplies the input by some learned weights to create a new vector which are trained during the training process. Embeddings also allow for similar words or sequences to be generalized into similar number sequences, which allows the model to generalize even easier. Similar words are closer to each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bCZRd3gGUmXvzCXQ" /><figcaption>Embeddings Map</figcaption></figure><p><strong><em>Encoder: </em></strong>The encoder is an LSTM layer that produces the state vectors for the decoder. Essentially what the encoder is doing is that it processes the input and extracts the most important features. LSTMs have multiple state vectors that it aggregates, but essentially what the LSTM keeps track of is the long-term, short-term and produces an output. Propagating our input through this allows for crucial extraction of important features of our input, later to be constructed back into a sequence from the decoder.</p><p><strong><em>Decoder: </em></strong>The decoder is also an LSTM but reconstructs in some sense the output from the decoder. It is able to produce a representation of the new sequence from the encoder features. The decoder outputs are then run through a dense layer to produce the final sequence, which is encoded into numbers. These extremely specific neural network functionalities are what allows for the sequence 2 sequence model to be so effective. The parameters can be easily learnt with enough data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4dLrNaHsNz2ZbMJu" /></figure><h4><em>Training / Results</em></h4><p>This model trained very well and achieved magnificent results. There were only around 20 000 parameters (small for a neural network) but it was able to create a protein sequence to 90% accuracy and got down to a 0.4 loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/0*1e7T_cWNIFKxiSr5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*kK-00WrbTIvJqNSm" /></figure><p>No signs of over fitting for the 20 epochs it was run for, which means it’s still got room for improvement! Overall, this works really well.</p><h3><strong>Demo</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*baDLDoOvnrDr-gF9.png" /><figcaption>Melanoma Antigen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*_dHUwO80LehOvNLu.png" /><figcaption>Herpes Virus Antigen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*7v9uGipjWW5Fg-DK.png" /><figcaption>Yellow Fever Virus Antigen</figcaption></figure><h3><strong>Implications</strong></h3><p>I envision a future where pandemics, disease and viruses can be dealt with in a secure, hasty manner. We are inevitably going into a more personalized focused medical system that favours those with money over the general public. We as a society need to address large scale disease and make it accessible to everyone, and I believe that CAR T-cell therapy is something we need to be working to advance. Breakthroughs in research can expedite the process of getting it out widely to the market, but we will need full cooperation of world governments to achieve accessibility for everyone. This solution I’ve proposed helps in making CAR T-cell therapy better but not more accessible. As higher accuracy goes up, we need to ensure usability goes up as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*Vi82Ylq7_FCy9csO" /></figure><p>This project also helps cement the use of NLP technologies in the medical field (which is becoming more reliable). A lot of people don’t trust these A.I to help with medical discovery, but the fact is that it makes our current medical technology better.</p><p>Code for project: <a href="https://github.com/Vansh-Sethi/Predicting-Properties-of-T-Cells-to-Increase-Immune-Response">https://github.com/Vansh-Sethi/Predicting-Properties-of-T-Cells-to-Increase-Immune-Response</a></p><h3><strong>Key Takeaways:</strong></h3><ul><li>Problem: Predict the CDR3 protein sequence, variable segment &amp; joining segment of a T-cell given the epitope of an antigen</li><li>Epitope data can be represent as number through word encodings and embeddings</li><li>Variable segment &amp; joining segment can be predicted using classical <a href="http://becominghuman.ai/">neural networks</a></li><li>CDR3 protein sequence can be predicted using a Sequence 2 Sequence model</li></ul><blockquote>Thank you for reading! It means a lot that people engage with my content and I can bring some of my own insight. Feel free to contact me via my <a href="https://vanshs.com/">website</a>. Thank you again!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9199a957f728" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Confusion Matrices are Not Confusing!]]></title>
            <link>https://medium.datadriveninvestor.com/confusion-matrices-are-not-confusing-2a6a9302c2?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a6a9302c2</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Thu, 12 Mar 2020 16:16:04 GMT</pubDate>
            <atom:updated>2020-03-16T11:29:59.811Z</atom:updated>
            <content:encoded><![CDATA[<h4>Explaining how these vital visual representations of machine learning models work.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_oYem0Y-qA74CvbRqRVzg.png" /></figure><h3><strong>A Data Scientists’ Dilemma</strong></h3><p>Big companies are getting involved with machine learning like never before. Especially with the necessity of data scientists steadily growing in big companies, data scientists bare a big job in the machine learning consulting space. One issue that arises from data scientists in big companies is the issue of communication with other branches in the company. Miscommunication and misinterpretation between data scientists and non-data scientists cost lots of money and time. The question becomes, how do data scientists communicate reports and metrics about their current projects to upper management? The answer used to be building a structure in the company with lots of confusion, however recently, the agreed-upon medium has become <strong>confusion matrices</strong> (it’s a bad name) which are visual representations of machine learning models.</p><h3><strong>Confusion Matrices — The General Explantation</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/0*baiNgcU16pct7njb" /></figure><p>To clearly understand how confusion matrices work, it is first important to understand the goal of any machine learning model. A machine learning model takes in an input and produces an output. Machine learning is where we make this process even better and teach the model how to give the desired output every time. There is a label to the input which is the true label and the predicted label which is the model’s output. <strong>Confusion matrices are a visual representation of how accurate a model is for a test set. </strong>A confusion matrix compares the true labels to the predicted labels of a model. It adds a value to a certain portion of a N x N grid, where N represents the number of labels in a test set. Here are the cases for the confusion matrix:</p><ul><li><strong>True Positive: </strong>The true label is the same as the predicted label, and the label represents a positive match in the data.</li><li><strong>True Negative: </strong>The true label is the same as the predicted label, and the label represents a negative match in the data.</li><li><strong>False Positive: </strong>The true label is different than the predicted label, and the true label is a negative match in the data whereas the predicted label is a positive match in the data.</li><li><strong>False Negative: </strong>The true label is different than the predicted label, and the true label is a positive match in the data whereas the predicted label is a negative match in the data.</li></ul><p>The way a confusion matrix is created and filled with values is part of the testing phase of the model. The model is run on a predefined amount of data points and is made to predict each and every one. For every data point and it’s prediction, one of the following cases will be filled and the grid corresponding to the case will go up by one. This happens until the whole test set is iterated through and the grid is filled up.</p><p><a href="https://www.datadriveninvestor.com/2019/02/07/8-skills-you-need-to-become-a-data-scientist/">8 Skills You Need to Become a Data Scientist | Data Driven Investor</a></p><p>It’s important to know that the amount of cases for a confusion matrix grows as the number of labels goes up. The more labels, the more complex the confusion matrix will inevitably be.</p><h3><strong>A Practical Example</strong></h3><p>Let’s analyze a practical example of a confusion matrix being used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/0*Jm2Bqi7-oy1lAFwn" /></figure><p>Here we are classifying cats and dogs with a model. There were 100 data points in the test set of the model. You can see the breakdowns above, but only 25% of the data points were guessed correctly. This is considered a bad model since it doesn’t get most of the data points correctly.</p><h4><em>A splash of colour!</em></h4><p>Colour is very common in confusion matrices. Colour is used because of the need to communicate these models graphically and easier to upper management. The colour usually represents how much a certain grid was predicted. Usually, the more intense the colour, the higher the value of the grid. Using colours, it can be easier to tell how good a model is.</p><p><strong>Pro tip: When there is a diagonal of intense colours, it usually means the model is good because those are the true positive grids.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/0*GgL5EFRFpLvwsoFK" /></figure><h4><strong>Let’s create a confusion matrix!</strong></h4><p>Let’s create a confusion matrix on cancer detection on images. Here are the parameters.</p><ul><li>100 data points in the test set</li><li>2 classes; one class that represents that cancer is within the image and one class that represents no cancer within the image</li></ul><p>Since we know that there are 2 classes, it has to be a two by two grid with four sections. Since there are 100 data points, we have to test our model on each one and add values to the grid. After doing the 100 data points and adding it to the confusion matrix we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*RCkxWEJJrEFZ0r0a" /></figure><p>Here’s our created confusion matrix. As you can see, we have the diagonal colour shift, which is an easy tell that this is a good model!</p><h3><strong>Bridging the Gap of Machine Learning</strong></h3><p>Confusion matrices are making it much easier for anyone to understand how good a model performs. So the next time you see a confusion matrix, you can critique the model. Confusion matrices are fundamentally making it easier for upper management and other non-machine learning developers to understand how these models work, which saves lots of money and time. This is the wonderous world of confusion matrices.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a6a9302c2" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/confusion-matrices-are-not-confusing-2a6a9302c2">Confusion Matrices are Not Confusing!</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metastatic Cancer Detection in Histopathological Image Scans]]></title>
            <link>https://medium.com/data-science/metastatic-cancer-detection-in-histopathological-image-scans-de4eeb570a8?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/de4eeb570a8</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[medicine]]></category>
            <category><![CDATA[cancer]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sat, 29 Feb 2020 14:28:16 GMT</pubDate>
            <atom:updated>2020-02-29T14:28:16.838Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Machine Learning to predict if Cancer is within Microscopic Images.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XisG1uO2Fr28-XCVK2J8zQ.png" /></figure><h3><strong>The Terrible Tale of Cancer</strong></h3><p>Cancer continues to be one of the world’s most deadly diseases, killing over <strong>10 million+</strong> people a year. One of the reasons that cancer is so deadly is that if it’s left unattended even for a short period of time, it can have already taken over a biological system. Early diagnoses are the key to battling cancer, and machine learning is revolutionizing early diagnosis.</p><p>Machine learning is able to deduce patterns in things that humans can’t. This includes finding very abstract patterns in images. Using the power of machine learning, a model can be created to deduce cancerous cells from non-cancerous cells in image scans. <strong>Convolutional Neural Networks </strong>can also help with this problem, as they are perfect for finding relationships in spatial sensitive data like image scans.</p><h3><strong>Metastatic Cancer</strong></h3><p>Cancer usually starts in a primary place in the body and then spreads viciously. Cancer that results from the primary place in the body is metastatic cancer. It’s essentially secondary cancer that is a direct result of primary cancer. So why are we looking for secondary cancer and not the root cause? Because it’s much easier to deduce secondary cancer when scanning the whole body and when someone has cancer, metastatic cancer is usually throughout their body in small quantities. Finding metastatic cancer is like an indicator to determine if someone has a crippling case of cancer somewhere else in their body.</p><p>Specifically, metastatic cancer can be found in different organs in the body. We can examine <strong>histopathological image scans</strong>, which are microscopic images of organs and cells within the body. Histopathological image scans have a great detail of different cells within what portion of the body one is looking at and can examine different diseases. However, it’s hard to tell in these scans if cancer is present or not since we aren’t all experts within the field of cancer research. <strong>Machine learning can be used to solve this issue, to tell if metastatic cancer is present in histopathological image scans.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*CZyRAxGbS-R3B1ZW" /><figcaption>Histopathological Image Scan</figcaption></figure><h3><strong>Machine Learning + Convolutional Neural Networks</strong></h3><p>Machine learning is all about getting machines to learn how to perform a specific task. Instead of giving explicit instructions, <strong>a machine learns to create its own instructions</strong>. In reality, all these instructions are mathematical values. A machine learning model is just a <strong>differentiable function</strong>, that takes in a predefined amount of input, uses variables (weights) to perform actions on the input and produces an output. It’s like <em>y = mx + b</em>. the <em>x</em> is the input of the model, <em>m</em> and <em>b</em> are the variables (weights) and the <em>y</em> is the output. The machine algorithm has to optimize the <em>m </em>and <em>b </em>weights so when given any input, it will always produce the desired output. How do we optimize our variables? There are essentially two steps, generating a loss and backpropagation.</p><h4><em>The Loss Function</em></h4><p>The loss function is a function that represents how bad the model performed. The higher the loss, the worse the model performs. We can generate the loss by using <strong>labelled data</strong>. We can give the model input of x and let it produce its own output based on its weights. Since we have labelled data, we know what the output of the model should be. We can compare the model’s output to the real output and see the difference. For example, the model’s output might be 3 and the real output might be 5. A loss for this example could be 2, which is how far apart the two outputs were. We want the model to always produce a loss of 0, which means we need to <strong>minimize the loss function</strong>.</p><h4><em>Backpropagation</em></h4><p>Backpropagation is the process of going back to the model’s weights and changing them to minimize the loss function. It does this by taking the loss function and calculating it’s gradient. The gradient is the instantaneous rate of change of the generated loss, and looking upon the gradient, we can go to the lowest point of our gradient where the weights produce a lower loss. This is called <strong>gradient descent</strong> and is key in a lot of machine learning algorithms. We can repeat this process until our loss keeps getting smaller and smaller, and while our model keeps getting better and better. Usually, a model will have thousands of weights, so the model can become very accurate when producing the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*LfEsG8tABE9kxV1k" /><figcaption><a href="https://mc.ai/gradient-descent-and-its-types/">Gradient Descent Visualized</a></figcaption></figure><h4><em>Convolutional Neural Networks</em></h4><p>Convolutional Neural Networks employ all the principals of machine learning mentioned above yet incorporate a method that can analyze spatial data, such as images and audio. It uses <strong>filters</strong>, a machine learning algorithm that uses weights to scan across the input data. Filters are a grid of weights that scan over the input data and at each scan, multiply the weight by the input. Since images are also just grids of values, convolutional filters can easily go over them. After a <strong>convolution</strong> or when it’s done scanning the image, the results of the scanning (the multiplied product) are pooled together. What the pooling is basically doing is representing the input data in a smaller concise way with all the important features. Essentially what convolutional neural networks do is that they deduce the special features of an image and put it all together.</p><p><a href="https://medium.com/@vanshsethi17/a-beginners-guide-convolutional-neural-networks-f40d64453904">For a more comprehensible explanation, check out this article I wrote explaining convolutional neural networks in more detail.</a></p><h3><strong>Metastatic Cancer Detection Model</strong></h3><h4><em>The Data</em></h4><p>The data used to create the model was the <a href="https://www.kaggle.com/c/histopathologic-cancer-detection/data"><em>Histopathologic Cancer Detection</em></a> labelled data on Kaggle. It comes with over 150 000+ images of histopathologic image scans with every image labelled with either a 1 or a 0. 0 Indicates no metastatic cancer is prevalent in the image and 1 indicated that metastatic cancer is within the image. Each image is 96 pixels by 96 pixels by 3 colour channels (Red, Blue, Green). We can represent each image by a grid of values of 96x96x3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*oCjX88yHX50lGoEneNbtWA.png" /><figcaption>Examples of Data</figcaption></figure><h4><em>The Model</em></h4><p>The conception of the model was based on the principles of machine learning and tailored toward the task at hand.</p><p>Convolutional layers were used for the <strong>feature extraction</strong> of the images, to generalize what a cancerous image looks like and what a non-cancerous image looks like. The layers are 2D convolutional neural networks meaning that the convolutional layers take 3D matrices of values (the representation of the images).</p><p>The max pool layers take the feature maps created by the convolutional layers and <strong>generalize</strong> them. It does this by taking max value for every 3x3 square in the image. This way, when the feature maps are given to the other parts of the neural network, it can have an easier time figuring out if an image contains cancer or not.</p><p>The dropout layers that are scattered throughout the network are to make sure that the model learns to perform the task and <strong>doesn’t just memorize the data</strong>. It does this by turning off certain weights during the loss calculation, which leads to a slightly lower accuracy yet generalizes to a wide array of images.</p><p>Lastly, the dense layers make sense of the feature maps and actually <strong>figure out if there is cancer or not</strong>. The last layer contains one node or output, which will either be a 0 or 1. 0 meaning no cancer and 1 meaning cancer. The loss function will use this to calculate the loss and backpropagation will optimize the weights in these layers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4385e3f9397b041760cd7bca3ed49208/href">https://medium.com/media/4385e3f9397b041760cd7bca3ed49208/href</a></iframe><p>The model contains over <strong>51 million+ </strong>parameters, meaning it can attain a really good accuracy.</p><h4><em>Loss Function + Optimization</em></h4><p>The loss function used for this model was the <strong>categorical cross-entropy loss</strong>. This loss takes the model output and performs the log function and multiplies it with the real loss. It uses the log function because as you start getting to the real answer, the loss gets exponentially better.</p><p>The optimizer used for this model was the <strong>Adam</strong> optimizer. This optimizer performs regular backpropagation but as it gets closer to the global minimum of the loss function, it slows down how fast it optimizer to prevent overstepping the minimum. It’s a pretty standard optimization function.</p><h4><em>Training</em></h4><p>The model trained for over <strong>10 epochs</strong> or performed backpropagation in<strong> batches of 100 images</strong> each 10 times over the whole dataset. 20% of the images were used for validation or making sure that the model was training. After a couple of hours of training, the model was finished.</p><h3><strong>The Results are in…</strong></h3><p>The model got an 80% accuracy rate of detecting cancer. Which means, 80% will be right in its prediction. Here are a few examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*J5ESRhgykdlOyiKadVKHpQ.png" /><figcaption>Examples of the Model</figcaption></figure><p>Overall, the model works very well and is a viable option when detecting cancer.</p><h4>References:</h4><p><a href="https://mc.ai/gradient-descent-and-its-types/">https://mc.ai/gradient-descent-and-its-types/</a> (Gradient Descent Image)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de4eeb570a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/metastatic-cancer-detection-in-histopathological-image-scans-de4eeb570a8">Metastatic Cancer Detection in Histopathological Image Scans</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using LSTMs to Predict Stock Prices]]></title>
            <link>https://medium.com/data-science/using-lstms-to-predict-stock-prices-a9965dfec2c9?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9965dfec2c9</guid>
            <category><![CDATA[stocks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[lstm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sun, 16 Feb 2020 20:48:44 GMT</pubDate>
            <atom:updated>2020-02-19T18:35:06.769Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Long-Short Term Memory Networks to Make That $</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXdgLJ_kzji9aqQxEQaIaQ.png" /></figure><h4>Face it. We’re dumb.</h4><p>A blindfolded monkey could manage a portfolio better than any human ever could. No, I’m actually serious. Numerous studies show that monkeys outperform humans in the stock market all the time. A monkey allegedly generated 8x more profit in a quarter than traders on the New York Stock Exchange. How can a clueless primate beat the so-called “geniuses” of wall street? The answer, <strong>dumb luck</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/0*lBFvkniRMbaiJVa-" /></figure><p>Humans try to gauge and predict stock prices all the time, using fancy statistics and trends to figure it out. But the truth is, humans aren’t able to comprehend the different variables that go into a stock price. We aren’t able to synthesize a company’s reputation, the projects they’ve announced and are working on, track record, past stock market data and factoring all that into making informed decisions on the stock market. We can’t consider every single variable and stat that ever existed about a company. But, computers can. More specifically, neural networks are designed to do exactly that.</p><h3>Long Short Term Memory Networks</h3><p>A neural network in a mathematical sense is a differentiable function that takes in an input and computes an output. Essentially, it’s your standard f(x) but instead of only one variable “x”, there are 1,000,000’s of x’s or parameters. Our goal is to optimize these parameters, as then we can feed in any input and get the desired output. These are neural networks in a nutshell, but an LSTM has some special properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*egcWK45M2JNLbHCE" /><figcaption><em>Don’t worry, I’ll break it down</em></figcaption></figure><p>A Long-Short Term Memory neural network is comprised of LSTM units or cells. These units have special computations to them and pass their output along to the next unit as input. In short, the main goal of an LSTM is to account for data that was passed in before into the output. Things like time-series data or stock market data are dependent on past versions of itself, and using an LSTM, it remembers the past and tries to predict the future. Here’s how it works.</p><h4>How data is propagated</h4><p>In stock market data and generally data that relies on past iterations of itself, at different times data was different. At a certain time, a piece of data was X. This is called time steps and data is entered into an LSTM cell broken down into its corresponding time step. For example, the 3rd LSTM unit takes in the 3rd time step of data or X3.</p><blockquote>Quick Notation: <strong><em>t-1</em></strong> indicates the values of the last LSTM cell and <strong><em>t</em></strong> is the output of the current LSTM cell.</blockquote><h4>Cell State</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/0*k3Q8trbDwYfxAw0h" /><figcaption>The Cell State</figcaption></figure><p>The notation for C indicates the cell state of the LSTM. The cell state is a vector of values that are passed through each cell in its own path. The current cell can use this cell state in its calculations or change the cell state entirely. Because of this, the cell state vector acts as the long-term memory part of the neural network. This is because it interacts with every LSTM unit and can thus factor in every unit when calculating the output of the next unit. This is where the long-term memory aspect of the LSTM comes from.</p><h4>Input Gate</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*x-gFnlhFTY4gL0U6" /><figcaption>The Input Gate</figcaption></figure><p>The input gate takes in the output of the hidden state (<em>ht-1) </em>of the last cell and the labelled data input (Xt) and uses this information to see if the cell state © should be changed. It first multiplies the data input and hidden state together, creating one new vector of values. It then takes the sigmoid and hyperbolic tangent function of this vector and multiplying those results together. If the product is above some trained parameter, it is then added to the cell state, essentially making the cell state memorize this important info. If it’s not added to the cell state, then it can be regarded as not important to the long term memory of the network. In short, the input gate determines if the information is important for the long term.</p><h4>Forget Gate</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*5AXILkiCrFf9LblE" /><figcaption>The Forget Gate</figcaption></figure><p>The forget gate takes in the output of the hidden state at the previous time step (ht-1) and the data input of the current time step (Xt). It then multiplies them together and applies the sigmoid activation to it. If the output is above some trained parameter, then the cell state is completely reset to 0, essentially forgetting it’s long term memory. This is why it’s called the forget gate because it has the capability to forget everything that was learned thus far. This helps in time-series predictions as a piece of data will act as a reset to the current trend and the LSTM needs to factor that in. However, an LSTM will rarely pass the forget gate.</p><h4>Output Gate</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*7j0NhG_pa3y8PeNR" /><figcaption>The Output Gate</figcaption></figure><p>The output gate prepares the next hidden state vector for the next cell (ht). It factors in the last hidden state vector and input data and applies a few functions to it. This is the short-term memory aspect of the neural network, as it is propagating new information into the next cell.</p><p>Notice how all three gates work together to create the cell state ©. At the end of all the units, the cell state is passed through dense layers which makes sense of all the long term memory and important info about the data to create a prediction of the next time step. Everything leads up to creating this cell state and it’s the heart of the LSTM. Training the LSTM network is done to make sure that the long term info makes it out into the end. Now you have a good understanding of LSTMs, let’s see how I applied them to stock market data.</p><h3>Stock Market Predictor</h3><p><a href="https://colab.research.google.com/drive/1wWCZK1IalVoc0JThyDktRKTDbkNkgJzi">*Created using Tensorflow and Keras.</a></p><h4>The Data</h4><p>The data that was used for this project was Apple’s stock price over the last 5 years. It was broken down into time steps of 10 minutes each. A neural network needs examples to train and needs labelled data, so the data was inputted in a specific way. The input was 50 timesteps and the label (which is what the neural network is trying to predict) is the 51st timestep. The neural network tries to predict the price at the next time step, and the data was created accordingly to train the neural network.</p><h4>The Architecture</h4><p>Surprise, surprise! I used a lot of LSTMs for this neural network. Each LSTM had 96 cells in it and returns the cell state into the next LSTM as input. In the end, it had 2 dense layers that took in the output of the LSTM layers and made sense of it. The last dense layer has one node in it, which indicates that it outputs one number, the predicted value of the next time step. It had over 1 million parameters it could optimize. The dropout layers were used to make sure that the neural network wasn’t just memorizing the data and the output. I know, all this work just to find the next value for the next timestep.</p><pre>model = Sequential([</pre><pre>layers.LSTM(units=96, return_sequences=True, input_shape=(50,1)),</pre><pre>layers.Dropout(0.2),<br>layers.LSTM(units=96, return_sequences=True),</pre><pre>layers.Dropout(0.2),<br>layers.LSTM(units=96, return_sequences=True),</pre><pre>layers.Dropout(0.2),<br>layers.LSTM(units=96, return_sequences=True),</pre><pre>layers.Dropout(0.2),<br>layers.LSTM(units=96, return_sequences=True),</pre><pre>layers.Dropout(0.2),<br>layers.LSTM(units=96),</pre><pre>layers.Dropout(0.2),<br>layers.Dense(1)<br>])</pre><h4>Training</h4><p>This model was trained using the popular Adam optimizer and MSE loss function. The loss function is how bad the model performed and the optimizer finds the minimum of the function, which are the best parameters for the network. It ran over 100 epochs and reached a loss &lt; 0.00001 (it performs pretty good).</p><h4>The Results are In</h4><p>So these are few examples of stocks it was used to predict. The blue shows the predicted price and the red shows the actual price.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*kRGIyZomawxg1ylgs_d2uA.png" /><figcaption>On Randomly Generated Stock Data</figcaption></figure><p>Overall, the model works decently well… but that doesn’t mean you should use this on the stock market. The stock market is very volatile and this model only uses past trends of a stock to predict the next.</p><h4><strong>References</strong></h4><p><a href="https://colah.github.io/posts/2015-08-Understanding-LSTMs/">https://colah.github.io/contact.html</a></p><p><a href="https://unsplash.com/photos/Z05GiksmqYU">https://unsplash.com/photos/Z05GiksmqYU</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9965dfec2c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/using-lstms-to-predict-stock-prices-a9965dfec2c9">Using LSTMs to Predict Stock Prices</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[a Beginner’s Guide Convolutional Neural Networks]]></title>
            <link>https://vanshsethi.medium.com/a-beginners-guide-convolutional-neural-networks-f40d64453904?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f40d64453904</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Wed, 12 Feb 2020 22:25:48 GMT</pubDate>
            <atom:updated>2020-02-12T22:25:48.577Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Beginner’s Guide Convolutional Neural Networks</h3><h4>Everything you need to know to get started with CNNs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRK-pJjlZsaMIFX8YryP0Q.png" /></figure><p>The range that computer vision applies to in modern society is broad. We use computer vision to diagnose major diseases. We use computer vision to unlock our phones.We even use computer vision as wacky snapchat filters. It was the creation of the <strong>Convolutional Neural Network </strong>that revolutionized the computer vision field and gave the ability for computers to “see.”</p><h4><em>How Computers see Images</em></h4><p>You and I see images by using light that hits our retinas and then processing the light in our brains to produce what we see. Computers don’t have this ability to read qualitative data such as light and interpret it in an abstract way to create an image. However, computers are really good with numbers and we give computers the ability to see by transferring it into this medium.</p><p>Particularly, we break up images into three main color channels, red, green and blue. This is where the term RGB comes from. Each color channel is made up of a grid of pixels that have a value attached to them. The value represents how intense a certain pixel is, for example if there was a pixel in the blue channel, the value would tell you how blue the pixel is. Each value is measured out of 255, a seemingly arbitrary number but is 255 specifically because it can easily be represented in binary. The red, green and blue colour channels are stacked on top of one of each other and a combination of a pixels’ red, green and blue channels can give us a variety of colours. We essentially can quantify images now, which makes it much easier for computers to understand and <em>see</em> images.</p><figure><img alt="Abraham Lincoln’s Face in Pixel Computer Form" src="https://cdn-images-1.medium.com/max/539/0*etbFvkIyqDIIxXtA" /><figcaption>“Building Facial Detection Software With JavaScript”, 2018</figcaption></figure><h4><em>What are CNNs and Why are they Special?</em></h4><p>CNNs is a type of neural network. A neural network is a concept derived from machine learning that mimics the functions of our brain to give the ability to computers to learn. CNNs are used in machine learning and artificial intelligence problems and is one of the more well known neural networks.</p><p>Traditional object detection and image classification hinges on the idea that the thing being analyzed is in the same place for all images. Or, that it maintains a constant part of the image. This is a niche method of going about object detection and image classification. CNNs solve this problem by being able to recognize objects regardless of their position. CNNs introduce the ability to find objects in spatially different images.</p><h3><strong><em>How CNNs Work</em></strong></h3><h4><em>Filters</em></h4><p>A filter is a defined N x M (N &amp; M represents the size of the grid) grid of numbers that is multiplied with the original image multiple times. It is slid across the image by a predetermined <em>stride </em>value and is multiplied with the current numbers. Every time the filters grid values are multiplied by the image grid values, the output for each value is summed together and is put into a new grid called the convolved matrix. This process is generalizing characteristics of an image by using the values of the filters. The values of the filters are determined in the training phase of the model, which is where the ‘machine learning’ aspect of the CNN comes to play. The filters are the heart of convolutional neural networks.</p><figure><img alt="Image Matrix &amp; Convolved Matrix" src="https://cdn-images-1.medium.com/max/920/0*xL-DCRs8x6QBc-9A" /><figcaption>“Convolutional Filters, a Popular Choice”, 2018</figcaption></figure><h4><em>Pooling</em></h4><p>The pooling layer is used to generalize the features extracted from the convolutional layer and represent it in a compressed way. There are many different ways to pool the convolved matrix but the most used pooling method is max pooling. Max Pooling takes the largest number in a predefined section of the convolve matrix, essentially taking the most significant part of that section of the image.</p><h4><em>Padding</em></h4><p>One of the issues that arises with CNNs is the fact that filters can’t operate on edges, and there will be some parts of the filter not actually on a pixel value. Padding solves this by adding a ring of extra pixels around the original image, so the filters can process the full image. The value of the extra pixels that are added are 0. The reason for this is because 0 essentially ignores that value and represents no significance to the filter, essentially acting as a placeholder.</p><p><strong>Dropout</strong><em><br></em>To make sure that the parameters of the CNN will not memorize the dataset and actually generalize data, dropout layers are used. Dropout layers turn off filters periodically to make sure that the weight of the parameters is shared equally among all the filters. If all the parameters play a decently sized role in the model, then the model will have an easier time generalizing.</p><h4><em>Training</em></h4><p>With all the basic parts of the CNN layed out, the real fun finally begins. Training is what allows CNNs to actually work by giving them the ability to find the best parameters to get the best accuracy possible. The training phase consists of two steps, the loss function and the optimizer.</p><p>The loss function calculates how bad the model did. It does this by taking the predicted output and comparing it to the actual output (label). It uses some functions (there are many) and outputs a total loss. The most common loss for CNN classification is categorical cross-entropy. The higher the loss, the worse the model did. Knowing this, if we can minimize this loss and get lower numbers, then our model will do better. To do this, we use optimizers.</p><p>The optimizer minimizes the loss function by computing the gradient. The gradient is like instantaneous rate of change in calculus, and essentially tells you which direction to go in to minimize the loss. It then proceeds to go in the direction where the loss is lower. This process of loss function and optimizer is repeated over multiple epochs until the developer is pleased with the result.</p><figure><img alt="The training process" src="https://cdn-images-1.medium.com/max/602/0*sq_czizYOs2OFTg-" /><figcaption>“Linear Regression Simplified — Ordinary Least Square vs Gradient Descent”, 2018</figcaption></figure><h3><strong><em>Applications of CNNs</em></strong></h3><h4><em>Image Classification</em></h4><p>CNNs are really good at classifying images into different categories. The extracted features from the convolution layers allows this to happen. We have been able to classify a multitude of things to cancerous cells and brain tumors to simple dogs and cats separator.</p><h4>Image Segmentation / Object Detection</h4><p>Image Segmentation is image classification and figuring out where a certain object is in within the image. From CNNs, you can extract the feature maps of an image. Feature maps are the main features of an image, and dense layers can figure out the coordinates on the screen that pertain to the object. It can then also classify it. Things like snapchat filters run on this algorithm.</p><figure><img alt="Different uses for CNNs" src="https://cdn-images-1.medium.com/max/1024/0*DaOL3gwRF5MXvH9d.jpeg" /><figcaption>“Object Detection With CNN, RCNN And Fast RCNN”, 2019</figcaption></figure><h4>GANs</h4><p>Using the feature maps produced by CNNs, we can create new images from them. To do this, we use a GAN or a general adversarial network which takes in noise and produces an image out of it. It learns how to do this by using a CNN to figure out how the image should look and common patterns between all images. (very simplified explanation).</p><figure><img alt="GAN in action" src="https://cdn-images-1.medium.com/max/507/0*OkvDxWuKpx43JqGA.gif" /><figcaption>“ThisPersonDoesNotExist.com uses AI to generate endless fake faces”, 2019</figcaption></figure><blockquote>On a More Personal Note</blockquote><blockquote>Thank you so much for reading this article. I’m constantly exploring machine learning topics and creating projects centered around practical uses of the technology. Check out my personal website for more!</blockquote><blockquote><a href="https://vanshs.com/">Click Here!</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f40d64453904" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designer Babies: The Ethical Dilemma with Gene Editing]]></title>
            <link>https://medium.com/swlh/designer-babies-the-ethical-dilemma-with-gene-editing-67d7220bc2f5?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/67d7220bc2f5</guid>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sat, 25 Jan 2020 14:17:07 GMT</pubDate>
            <atom:updated>2020-01-25T18:04:06.205Z</atom:updated>
            <content:encoded><![CDATA[<h4>A discussion on the ethical dilemmas that are faced with the power of gene editing.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zdq2OEh4AGy9OqDfauH9Uw.png" /></figure><p>Gene editing is the process of changing and altering the genetic code of different organisms. The applications for gene editing are vast… from modifying plants so they have a longer shelf life to fighting genetic diseases, gene editing can do <strong>a lot</strong>. Even though breakthroughs in gene editing will change the world, should we allow it to? Gene editing has some major drawbacks when you put an ethical lens on it, and in this article I’ll go over some of the main arguments. Specifically discussing gene editing on babies and fetuses. A very crucial topic to discuss as the ability to edit fetuses and embryos is becoming more accessible every day.</p><h4>A Little bit about how Gene Editing works</h4><p>There are many methods to go about gene editing yet the most popular and widely accepted method is the CRISPR-Cas9 system. CRISPR stands for <em>clustered regularly interspaced short palindromic repeats</em> which is a fancy explanation for how it actually works. The CRISPR-Cas9 system analyzes parts of DNA until it finds a part that is identical to what you tell it to. For example, if you were looking for the DNA sequence that handles hair colour, you would program CRISPR to find that sequence. Once found, the Cas9 which is a protein cuts the unwanted sequence and can add its own sequence of DNA. This is done by using guide RNA. By changing the original sequence, you can alter the organisms original properties. Going back to the hair example, you can edit the sequence so the color is different (like blonde or brunette).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*FQJtiEyCQ5ETEBfZkGq1nw.gif" /><figcaption>CAS-9 Comparing Sequences</figcaption></figure><p>Using this system to edit embryos’ DNA allow for people to essentially customize the properties of their children. For example, you could have your child have certain looks, features or could even program parts of your body to fight certain diseases (eg. cancer). This is being referred to as creating designer babies, and have some ethical issues associated with them.</p><h4>Ethical Dilemma #1: Is it consensual?</h4><p>Babies in the womb and embryos don’t have the ability to actually consent to this kind of treatment. As a matter of fact, they are essentially unconscious organisms that show no ability to think of anything. The law states that one must be conscious to actually give some form of consent. If embryos can’t consent, then how is it legally/ethically okay for their genetic code to be edited? The law also states that persons under the age of eighteen have people that consent for them like their parents. But at that point, is it fair that parents get to build exactly who they want and limit the freedoms of the child? We have a dilemma here, where these embryos can’t consent but if the parents consent for them, then we are essentially limiting rights and freedoms, which is also morally wrong.</p><p>The common counter-argument to solve this ethical dilemma is that genetic engineering the baby is for their own good, because we can stop diseases and fundamentally make them better in real life. This is sort of an altruistic mindset that assumes that the child will actually conform to the edits made to their own code. What if the child doesn’t necessarily want certain edits. Then you are stuck going back to questioning of limiting the rights and freedoms of the child, which is fundamentally flawed. But, if you accept this argument in the idea of the greater good, then there wouldn’t be a dilemma.</p><h4>Ethical Dilemma #2: Is it fair?</h4><p>We live in a pretty equitable society where marginalization is becoming less of an issue. With the introduction of genetically modifying humans to become perfect, we have to discuss is it fair to those less fortunate. If this was introduced and legally okay in society, some children are <em>literally</em> better than everyone else. They would be better in academics, sports, creative processes, literally everything. And it’s not even because they are naturally born that way, it’s because they have been given a boost from gene editing. This edge would give more opportunity to the genetically modified in virtually every field and opportunity. Job opportunity? Only if you have a certain gene. The result of this is that society would indefinitely frown upon the non-edited humans and praise the genetically edited humans. This leaves an ethical dilemma where equity is thrown out of the question, a fundamental truth to ethics.</p><p>A counter argument to this dilemma is that it’s in the benefit of everyone if we started editing humans because it would lead to more innovation. Big problems like climate change, human exploration and human longevity would be able to be worked on if there were smarter people on this earth. This would in turn benefit those non edited as they live in a fundamentally better place. This altruistic type of mindset shows that it’s done for the greater good.</p><p>The argument that wins here is the argument that proves to be more impactful than damaging. Allowing for genetic editing gives more marginalization but also more innovation. Not allowing genetic editing leaves us in the status quo. I believe that marginalization can be dealt with and the returns of innovation are always a positive, so in my opinion, genetic editing is fine under this lens. But, there isn’t a right answer here, hence why it is a dilemma.</p><h4>Ethical Dilemma #3: Is it safe?</h4><p>The last barrier to genetic editing going more mainstream is the fact that it’s somewhat unsafe. Off-target edits could give us results that end up being cruel and unwanted by the child. One thing that is more than likely is that there will be mishaps when editing embryos. We see this with any medical procedure, and the general consensus is that we will never reach 100% accuracy. With this being said, do we take the plunge where we take this risk? In this dilemma, there are definitely people that will get the short end of the stick and be modified where they get unwanted genetic properties. Is it fair that some people will have to be negatively affected by gene editing and everyone else will be able to prosper. It’s a dilemma of equity but also cruelty. Unwanted genetic variants could lead to strange and cruel properties of the child. We as a race are being cruel in this manner when we allow gene editing to be mainstream. Some of these children could’ve lived normal lives but are disadvantages because of human error.</p><p>The argument to this dilemma is that innovation will get better and better and will lower the risk of this happening. Yes, this is true, and as the technology gets better, we will have less off target practices. But it’s hard to say that we will always get 100% when dealing with genetic editing. Even the most common procedures today still aren’t 100% accurate.</p><p>To solve this dilemma is to figure out if we can reach 100% when it comes to genetic editing or living with the fact that some people will be genetically disadvantaged. It all comes down to what is possible by the human race.</p><h3>Gene Editing: is it Worth it?</h3><p>When you revise all these dilemmas and look back on the risk and reward, one thing becomes abundantly clear. Gene editing is here for the benefit of humanity and will fundamentally help humans out. However, the pitfalls make it hard to figure out if gene editing is an ethically sound thing. But we need to take a practical lens to gene editing. The major fact is that it is here to stay and will be used, so we can talk ethics all day but what is the actual benefit of gene editing. In my eyes, the ability to change the human race for the better and to everyone’s benefit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FjRNI5dGIy7tkT0g.jpg" /><figcaption>Gene Editing from the Beginning.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67d7220bc2f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/designer-babies-the-ethical-dilemma-with-gene-editing-67d7220bc2f5">Designer Babies: The Ethical Dilemma with Gene Editing</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Neural Networks (and what each one does!) Explained]]></title>
            <link>https://medium.com/data-science/types-of-neural-network-and-what-each-one-does-explained-d9b4c0ed63a1?source=rss-940f367dd4d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9b4c0ed63a1</guid>
            <category><![CDATA[exponential-technology]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Vansh Sethi]]></dc:creator>
            <pubDate>Sat, 28 Dec 2019 21:58:19 GMT</pubDate>
            <atom:updated>2019-12-29T18:59:25.549Z</atom:updated>
            <content:encoded><![CDATA[<h4>There are an abundance of neural networks that have captivating properties to them. Here are the most notable ones.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FyWf3y_y2UJhWfuAq-3PtA.png" /></figure><p>Machine learning — a subset of Artificial Intelligence — incorporates neural networks to create some amazing software that we use on a daily basis.</p><p>If you used Google to find this medium article, you used Google’s neural network that ranks the most relevant pages based on the keyword(s) you gave it. If you recently went on Amazon.com, all the recommended products that the website suggested to you was curated by a neural network. Even today, if you used your phone, you probably encountered a neural network that made your life easier. It’s all around us, and they all do different things and work in different ways.</p><h3><em>So… What is a “Neural Network”</em></h3><p>The word ‘Neural’ is just another word for the Brain. <em>“So it’s a </em><strong><em>brain</em></strong><em> network?” </em>In essence, totally! A neural network is a simplification of our most powerful tool, the <strong>brain</strong>. It uses <strong>neurons</strong> that are all connected to each other through <strong>weights</strong> (the lines in the image below). The neurons are given some numerical input and are multiplied by the weights. The weights are the heart of the neural network, and by changing them to specific numerical values, we can process any input and get a desired output. A neural network is just a way to process data. Data is the 🔑 here and by manipulating data through a variety of neural networks… we can build very powerful tools that do some insane things!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*fwh8O_gdlrx_ORR8.png" /></figure><h3><em>The Perceptron — The Oldest &amp; Simplest Neural Network</em></h3><p>The perceptron is the oldest neural network, created all the way back in 1958. It is also the simplest neural network. Developed by Frank Rosenblatt, the perceptron set the groundwork for the fundamentals of neural networks.</p><p>This neural network has only <strong>one </strong>neuron, making it extremely simple. It takes <em>n</em> amount of inputs and multiplies them by corresponding weights. It computes only one output. It suffers because of its lack of complexity in that it can only process data with one level of complexity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*nk1wqcRZIjHd1mPt" /></figure><h4>Use cases:</h4><ul><li>Understanding the human brain</li><li>Scaling up for more advanced neural networks</li></ul><h3><em>Multi Layer Perceptron — What are layers?</em></h3><p>A multi layer perceptron (MLP) is still a perceptron however there is added complexity through the advent of <strong>layers</strong>. There are three types of layers in an MLP:</p><h4><em>Input layer</em>:</h4><p>The input layer is what it sounds like, the data you are inputting into the neural network. Input data has to be numerical. This means you might have to take something that is non-numerical and find a way to make it numerical. The process of manipulating data before inputting it into the neural network is called <strong>data</strong> <strong>processing</strong> and often times will be the most time consuming part to making machine learning models.</p><h4><em>Hidden layer(s)</em>:</h4><p>The hidden layers are composed of most of the neurons in the neural network and is the heart of manipulating the data to get a desired output. Data will pass through the hidden layers and be manipulated by many weights and biases. It is called the “hidden” layer because developers of neural networks will not directly work with these layers, opposed to input and output layers.</p><h4><em>Output layer:</em></h4><p>The output layer is the final product from manipulating the data in the neural network and can represent different things. Often times, the output layer consists of neurons that each represent an object and the numerical value attached is the probability that it is that specific object. Other times, it could be one neuron output that is the value of something when given certain inputs. The main idea is that output layers is the result of the data when passed through the neural network, and the goal we are trying to reach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*qcOTPXaSB_rt66CW" /></figure><h4>Feed forward Principal:</h4><p>The idea is that we pass numerical data into the networks and it continues forward having many operations done to it. We feed data forward. To get the right operations such that any input given will always produce a desired output requires <strong>training</strong>. Training is essentially finding what yields the best results and applying them to the network.</p><h4>Use cases:</h4><ul><li>Computer Vision</li><li>Natural Language Processing</li><li>Basis for other neural networks</li></ul><h3><em>Convolutional Neural Network — Convolutional Layers?</em></h3><p>A convolutional neural network still uses the same principles that MLPs use, however this neural network implements convolutional layers. It is important to note that convolutional neural networks are usually used for images and video.</p><p>It is important to recognize that images are just a grid of numbers, and each number tells you how intense a certain pixel is. Knowing that it is a grid of numbers, we can manipulate these numbers to find patterns and characteristics of the image. Convolutional layers do this by using filters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulfFYH5HbWpLTIfuebj5mQ.gif" /></figure><h4><em>Filters</em></h4><p>A filter is a defined N x M (N &amp; M represents the size of the grid) grid of numbers that is multiplied with the original image multiple times. To understand what is actually happening, refer to the animation.</p><p>The filter is moved across the grid and produces new values. These new values can represent edges or lines in the image. For example, take the filters below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*2lGVsuaLXPY072h7" /></figure><p>The horizontal filter tries to eliminate the values other than the vertical center. It does this by using negative values to get rid of the edges and 0 for the center to make the pixels neutral. If the filter is successful, you will be able to see a horizontal line from the new values. The same is true for the vertical filter just reversed.</p><p>After the filters have been applied throughout the full image, we can easily extract the main features found by the filters using a pooling layer. Figuring out what numbers should be in the filter is decided when training the model. Figuring out what are the best numbers will yield the best results for the overall task.</p><h4><em>Pooling Layer</em></h4><p>Pooling layers do what they sound like. They “pool” together the most important characteristics found by the filters. This is done by using multiple methods. One popular method is Max Pooling, where for each filtered part of an image, the largest number is taken and stored into a new grid. What this basically does is takes the most important characteristics and compresses them into one image, for it to be processed into an MLP. This process can also be known as data sampling, and using this process yields very promising results.</p><h4><em>Use Cases</em></h4><ul><li>Image classification</li><li>Computer vision</li><li>Find characteristics / patterns in images</li></ul><h3><em>Recurrent Neural Network — Temporal Data?</em></h3><p>The data we can analyze with neural networks is not completely confined to static data. Things like images, numbers and frames are all data that can be analyzed by itself. However, data that depends on past instances of itself to predict the future are examples of temporal data. Things like stock market data, time-series data, brain-wave data and more are always analyzed by using past instances of a dependent variable. The neural networks mentioned thus far don’t address other states of data, however RNNs are the solution.</p><h4><em>State Matrices</em></h4><p>RNNs remember previous states of data by storing the last output in it’s own memory. These are called <strong>state matrices</strong>. It works like a normal layer in an MLP but it uses the state matrix to calculate the new output. Using previous outputs and states of data essentially considers that data in the final output. This is crucial for applications like stock-market predictions and time-series forecasting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*5EcqQO-2xmNn-7fVsYol1g.png" /></figure><h4><em>LSTMs</em></h4><p>Long Short Term Memory networks further expand on this idea of saving <strong>state matrices </strong>in two states. There is a long-term state and a short term state. If a state persists in the model output, it will become a long-term state matrix and will weigh more when considering new data.</p><p>The LSTM system is super efficient when finding patterns in continuous data and is at the forefront of stock market predictors.</p><h4><em>Use Cases</em></h4><ul><li>Natural Language Processing</li><li>Stock Market Predictions</li><li>Time based data predictions</li></ul><h3><em>Autoencoders — Representing Data in a Compressed Way</em></h3><p>Most neural networks take in data and make some types of decisions. Autoencoders have a different task, and that is to figure out a way to compress data but maintain the same quality.</p><p>Traditionally in machine learning, the labels attached to our data are different and the goal of the neural network to produce. In an auto encoder, the labels are the same as the inputs.</p><p>So, in this architecture, you have an identical input and output layer. The hidden layer is smaller than the input and output layer (in terms of nodes) and is called the <strong>“bottle neck”</strong>. Since the bottleneck is smaller, it is forced to find a way to compress the original data and put it back in the output layer. This compression is often better than conventional means because it can still maintain high quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/0*GscoY2U2QxZ04MX-" /></figure><h4><em>Use Cases:</em></h4><ul><li>Mostly for representing large amounts of data in a smaller, compressed way.</li></ul><h3><em>Key Takeaways</em></h3><blockquote>Multi-layer Perceptrons (MLPs)</blockquote><ul><li>Basic neural network</li><li>Used for simple tasks</li></ul><blockquote>Convolution Neural Networks (CNNs)</blockquote><ul><li>Uses filters and pooling to find characteristics in data</li><li>Mostly used for image tasks</li></ul><blockquote>Recurrent Neural Networks (RNNs)</blockquote><ul><li>Uses the previous result of data in figuring out new output</li><li>Used for temporal data</li></ul><blockquote>Auto encoders</blockquote><ul><li>A new way to compress data without losing quality</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9b4c0ed63a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/types-of-neural-network-and-what-each-one-does-explained-d9b4c0ed63a1">Types of Neural Networks (and what each one does!) Explained</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>