<?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 Emmanuella Anggi on Medium]]></title>
        <description><![CDATA[Stories by Emmanuella Anggi on Medium]]></description>
        <link>https://medium.com/@emmanuellaanggi?source=rss-2b61d2c09f4d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5b9E-LgVhfOo08Wv5z__-g.jpeg</url>
            <title>Stories by Emmanuella Anggi on Medium</title>
            <link>https://medium.com/@emmanuellaanggi?source=rss-2b61d2c09f4d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:39:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emmanuellaanggi/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[Thought, Thinking, Think]]></title>
            <link>https://emmanuellaanggi.medium.com/thought-thinking-think-3dfd20e36727?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dfd20e36727</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Mon, 19 Jul 2021 05:44:43 GMT</pubDate>
            <atom:updated>2022-05-29T10:41:57.758Z</atom:updated>
            <content:encoded><![CDATA[<h4>This week, I learned how to be more organized. And— <em>spoiler alert</em>— it’s not about getting my room tidy or using Notion. It’s <em>data analytics</em>.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KCsfPIXM-U5IsxQcoJWEzQ.png" /><figcaption>Miss Auras, The Red Book — John Lavery (1892)</figcaption></figure><p>It’s such a pleasure to study with different perspectives all the time. Especially when you’re in tech. When I first learned about coding, my eyes were always fixed on how to make the code work, then I knew that a working code is not all that. I also had to make it run efficiently. And also <em>clean</em>. Then with design, aestheticism was only just a bit of it, there’s this about user experience: understanding the interaction between human and system bridged with design.</p><p>And then with data, I had drowned myself in techniques: statistics, tools, algorithms… And yet I often forgot how to start with <strong><em>thinking</em></strong>. When given data — all raw numbers and text — I tend to look at it and wonder: “What kind of algorithm will make sense of my data?” or “How should I clean this?” and then without knowing what I was going to do, I wondered, “what kind of graphic will make it more interesting to be read?”. Now thinking about it, how annoying it is to work without purpose or guidelines!</p><p>Here’s 3 steps that will help us to be more organized on data analytics!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*lNZIwPVpXtax0YsMd8BW9g.png" /><figcaption>MARIANA, ‘IS THIS THE END? TO BE LEFT ALONE, TO LIVE FORGOTTEN AND DIE FORLORN’ — <a href="http://www.artnet.com/artists/john-lavery/">John Lavery</a> (1880)</figcaption></figure><h3>Meditate</h3><p>The idea of meditation is to stop the mind rushing in an aimless stream of thoughts. So before going all crazy with the techniques, we should take a moment to create a purposeful process. Always question before starting to move on to the whole process of data analytics.</p><h4>What is our problem?</h4><p>Okay this sounds weird somehow, but really, what is the problem that makes us wanna go all the way to work with the data? Do breakdown our problems with Root Cause Analysis and Issue Tree. In a nutshell, working with finding the root problems will help us frame out goals too.</p><p><em>Read more about </em><a href="https://des.wa.gov/services/risk-management/about-risk-management/enterprise-risk-management/root-cause-analysis"><em>Root Cause Analysis</em></a><em> and</em><a href="https://www.craftingcases.com/issue-tree-guide/"><em> Issue Tree</em></a></p><p>By knowing our problems, we can create hypothesis. Having hypothesis will help us underlying theory, measure the validity and reliability, and focus on the outcomes — goals — of our analysis.</p><h4>What are the measurements are you looking for?</h4><p>When fixing a problem, you might want to know how to measure your problem and how to find the solution to it.</p><p>Assume we want to find out why there’s a decrease at total transaction in our platform, our goals is — of course — to increase the transaction back or even higher, and with all this we can focus on the most obvious metrics: Total Transaction.</p><p>So from there we can finally think “<em>what data do I need?</em>” and “<em>Which metric do I use?” </em>then move forward with working with the data.</p><h3>Interrogate</h3><blockquote>“Life can only be understood backwards; but it must be lived forwards.” ― <strong>Søren Kierkegaard</strong></blockquote><p>At this point I think I just made an excuse to plug in my most favorite quotes. But again, data was <strong><em>what happened</em></strong>, and understanding data is actually a form of going forward.</p><p>I think this one relates the most with processing the data and preventing producing a whole garbage. Cleaning, transforming, fitting the model, and all that stuff will be pointless if we don’t interrogate the data. Interrogating the data can be started by doing Statistical descriptive and Statistical inference.</p><p>Statistical descriptive helps to provide information about variables in our data and highlight potential relationships between variables. Some Statistical Descriptive that can tell more about our data:</p><ul><li>Frequency (<em>how often a response is given)</em></li><li>Central tendency (<em>how an average of most commonly indicate response)</em></li><li>Dispersion or variation (<em>how spread out the data are)</em></li><li>Position (<em>compare scores to a normalized score</em>)</li></ul><p>While statistical inference helps in the process of drawing conclusions about populations or scientific truths from data samples like the population (also by testing our hypotheses). And be responsible for every method we use on creating the conclusion.</p><h3>Narrate</h3><blockquote>“The only thing to do with good advice is to pass it on. It is never of any use to oneself” —<strong> Oscar Wilde</strong></blockquote><p>It’s so meaningless to find so much but can’t tell that much. Best deliverance we can give with all our findings is to narrate them so more people can understand it. Narrating it with an analysis document is basically wrapping up all your process into one well-ordered writing. I think personally, this might be a step to evaluate all the steps too.</p><p>Make sure to tell the process with a story: what has been done or what will be done. State the data sources, the transformed data, what hypotheses we use. and what approach applied. Some tips on writing analysis docs I learned were being specific and detailed about the process, and never being biased by your limited knowledge. Knowing that you don’t know everything is actually so helpful to widen your mind, especially on inferring the result and giving recommendation.</p><h3>Reflection</h3><p><em>So… </em>that’s some of my favorite things I learned this week!</p><p>When learning, things might be tricky since I have to constantly shift my thinking, and the more I know, the more I know I don’t, right? So often, I see all the process, the new knowledge, the projects, as something that I need to devour on slowly. And by writing, I reflect all of those back again. I like to make myself believe that I am nowhere knowing everything. And with all that, I can make more spaces for new things and new perspectives on the way.</p><p>In the future, I hope I can be wiser working with data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JuPeJxZNpt_qr56EqLycSQ.png" /><figcaption>Winter in Florida — John Lavery</figcaption></figure><p>**<em>Note: I use several paintings from John Lavery in this article. No particular reason. It’s just beautiful, isn’t it?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dfd20e36727" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surviving CS Final Research in Pandemic]]></title>
            <link>https://emmanuellaanggi.medium.com/surviving-cs-final-research-in-pandemic-558ebf030676?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/558ebf030676</guid>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Sat, 20 Feb 2021 04:23:49 GMT</pubDate>
            <atom:updated>2021-02-22T15:35:06.931Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This sits on my draft for long so maybe I’ll post it now cause why not</em>🥲👍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*bRFGE7iOUc-wiy9c" /><figcaption><a href="https://unsplash.com/photos/3mt71MKGjQ0">https://unsplash.com/photos/3mt71MKGjQ0</a></figcaption></figure><p>I’ve been pointing some of things that helped me finished my paper (during the pandemic!). And to be honest, I don’t feel like I’m doing the best but it’s enough to get me finish it on time and it’s (at least for me) okay. So.. I’d like to share what I learned during every process on it. Hope it’s somehow helps.</p><p><em>Please note that I’m speaking on my own experience and every university is definitely different. The paper is for my bachelor degree, the topic is Natural Language Generation.</em></p><h3><strong>On finding Your Academic Advisor</strong></h3><p>This is the most important for me (especially in pandemic). In my case I was so lucky that I had the best advisors to assist me but if I have to point why it’s going smooth, here’s the one thing: <strong>They trusted me</strong>.</p><p>Trust was the most important thing and it saved <em>a lot </em>of time . You could get the best lecturer, the smartest one, the prominent one, but the most important thing is they trust you. Nothing more important than that. You don’t have to be the brightest kid in the class because being the brightest mean people will have high expectation on you, you just have to <strong>be dependable</strong>. You do your work, you support your advisor in class, talk to them, ask personal academic advise sometimes, you help them when you can.. They will trust you. In process, you are not your advisor’s only priorities, they’ll have so many works but you also need them to approve things/administrations.</p><p>To take an example, when I propose my title, we just had a little discussion whether it’s good or not then I could make an executive summary right away, my advisor got things she worried on my proposed research but she was convinced of <em>me</em>. There were a lot of steps and to go on the next step, they believed that I did my best on it, and they’re okay too with me proceeding before they did my revisions. But also <strong>do not ever break their trust</strong>. You’re not going to be fully perfect, but still put your full effort on that.</p><p>Find <strong>advisors that understand your idea</strong>. Subjects in college are very broad. In my case, I’m lucky that my advisor also teaches Artificial Intelligence which was my research theme. Make sure your advisor understands your idea, you could ask some seniors about which fields each of your advisor do on assisting final paper, or what kind of research they did for their master/doctorate, and choose the best for you.</p><p>Don’t forget to express your eagerness on your topic.</p><h3><strong>On finding your research title</strong></h3><p>You don’t find your title from nowhere. <strong>Spare a day to find it</strong>. I remember I spent a whole day, drank coffee (God knows how many cups), and sat where I felt most comfortable at. I studied in a cafe for 6 hours and when I got bored I went home but I still continued to do so. When you find an idea, write it down, find some academic sources links, and find another ideas. Get ideas as much as you can and at the end <strong>decide which one you feel most comfortable </strong>with. <em>Comfortable</em> because doing your research will somehow exhausting and you will find so many days working on nothing, stuck in finding your data, writing down things you barely understand yet.. So you have to be comfortable and keen about what you wanna do.</p><p><strong>Find code sources</strong> (emphasis on S, find lots of sources). This is the most important one, of course you will do a lot of modification later but you have to know that what you do is something possible, not just cool by technique. Also it’s okay if you referenced your title based on a project on Github, so when getting into the hands-on you’ll already have idea on what to do. Studying your code and understanding theory are way more simple after that.</p><p>If you haven’t found something you really love, this step is the best step to <strong>ask people</strong>. When you code, asking people can differ your direction. This is the step where you ask people whether your title could be done or not, or if they have perspectives on your ground ideas. Have lots of discussions, learn lots before you get in.</p><h3><strong>On Proposal</strong></h3><p>When you present your proposal: <strong>be confident</strong>. Act like you know fully what you’re going to do. Over confident is wrong and could make a bad impression tho, just tone it down a little bit. Make sure you know what’s the outcome of your research, you understand how the algorithm works, why it’s best for your data, and you know where you’ll get the data. You don’t have to be super detail on the architecture, just make sure it’s clear enough. Find lots of academic sources, you don’t have to understand all of it, just get the idea.</p><p>The thing about proposal is being good with your words. So read books. Anything. It helped me so much to puzzle what I wanted to convey.</p><p><em>“Read a thousand books and your words will flow like a river”</em></p><h3><strong>On doing the program</strong></h3><p><strong>Breakdown every point you wanna do</strong>. Don’t depend on your architecture in your proposal, its just a proposal after all.</p><p>Break it as detailed as you could, start from the general points and break down to the most detailed. From how you want to get and read the data, clean the data, pre-process it, how you wanna use the algorithm, what outcome do you wish after the model has trained, how do you want to deliver the outcome so it comes as clean as it possibly could.</p><p>This is a long process, it’s better to just not be satisfied and continue on thinking how to make it even better. Make sure you always had your notes around you. I had notes all over the places in my home when doing my program. Because..</p><p><em>“Your brain is for having ideas, not for holding them”</em></p><p>Make sure you got places to hold the ideas.</p><p>Next, I’m speaking on my own experience, so maybe a lot of people have different take on this but asking people is not a big help. Too many brains on a single program made you overwhelmed. People had different approaches to solve a problem, when someone got an approach in a way you didn’t expect, that doesn’t mean you’re doing it wrong and you had to reset everything.</p><p>Doing the program by yourself will help you give a good impression too, that even though you’re not perfect, it’s still a work that you do by yourself.</p><h3><strong>On Revision</strong></h3><p>After the proposal, I finished the whole paper before consulting. It’s not perfect yet, but it’s not raw too. But compare to consulting each process, it probably saved time better.</p><p>Before you send your progress, <strong>point what you did on your body e-mail</strong>.<strong> </strong>When I sent the file with e-mail the first time, I pointed important things that I did. The highlights of my progress, the things that I’m not sure yet. I elaborated my architecture casually. This is very important because your advisor can’t possibly read all your paper right away, so by giving the idea on what you did, your advisor can directly go the section where they want and give you feedback right away. Also, I think when I elaborate things in formal way, I kind of messed up things so explaining it my way made it easier for both of me and my advisor.</p><p>My advisor helped me a lot on my writing. She’s the one that helped me going on this research to be honest. I mean I love writing, but when it comes to the style I never wrote, it’d be somehow messy. So do your best in describing your step-by-step.</p><p>Don’t procrastinate. Once you got the revision, just do it right away.</p><p><strong>The rest is just <em>you.</em></strong></p><p>Don’t forget to be nice to yourself! Value your work, don’t stress out. Be confident, make sure you knew by heart the architecture and how your model works. Know that you had spent blood, sweat, and tears on that so you don’t have to be afraid of failing.</p><p>Perseverance is the key, friends.</p><p>Good luck! Thank you for reading❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=558ebf030676" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Classification With ResNet50 Convolution Neural Network (CNN) on Covid-19 Radiography]]></title>
            <link>https://medium.com/swlh/image-classification-with-resnet50-convolution-neural-network-cnn-on-covid-19-radiography-d2a1fd77f5fb?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2a1fd77f5fb</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Thu, 17 Sep 2020 04:55:18 GMT</pubDate>
            <atom:updated>2020-09-17T20:58:46.066Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*vjfLTTJfzMWqgWAe" /><figcaption>Source: <a href="https://www.ucsfhealth.org/medical-tests/x-ray---skeleton">https://www.ucsfhealth.org/medical-tests/x-ray---skeleton</a></figcaption></figure><h4>Using CNN with FastAI for Beginner</h4><p>On final year of uni, they offered three selection subject to choose: Image Processing, AR/VR, and Digital Forensic. I was trying so hard to be different and chose Digital Forensic, my own worst decision. It was so hard and without any interest on the field, i didn’t actually understand (surviving CS 101). Anyway, a lesson for me (and probably you): <em>just be realistic</em>.</p><p>So because I was so silly to choose another subject instead of image processing, I tried to learn it myself. Turned out, it’s even more fun to learn by yourself. I will list every source to understand Image Processing the easy way on every point. Anyway, Kaggle provides <a href="https://www.kaggle.com/learn/deep-learning">this free course</a> explaining very detailed about Image Processing with Deep Learning.</p><p>In this article, I used <a href="https://www.kaggle.com/tawsifurrahman/covid19-radiography-database?">Kaggle dataset</a> with X-ray images that classify COVID-19, Viral pneumonia and Normal Chest. There are 219 COVID-19 Positive images, 1341 Normal images and 1345 Viral Pneumonia images.</p><p>As always, head to <a href="https://github.com/emmanuellaanggi/radiography-images-classification">my Github</a> for the code❤️</p><blockquote>I linked every article I used as references as the underlined hyperlinks. Big thanks to each authors.</blockquote><h3>Image Classification</h3><p><a href="https://desktop.arcgis.com/en/arcmap/latest/extensions/spatial-analyst/image-classification/what-is-image-classification-.htm">Image Classification</a> is a method to extract information of image classes digitally. Shortly, it used to classify images. Image Classification can be supervised (you give label to each images) and also unsupervised (the training model learned to classify the images based on the patterns).</p><p>This article used Supervised Image Classification with three classes.</p><h3>CNN</h3><p>As I mentioned before, I am using Resnet50 layers, which is one of CNN architectures. To know more about CNN, <a href="https://medium.com/@RaghavPrabhu/understanding-of-convolutional-neural-network-cnn-deep-learning-99760835f148">this article</a> explained CNN so clear. To sum it up, the flow of CNN are:</p><ol><li>Convolution Layer (extract feature with filtering)</li><li>Strides (shifting pixels over the input matrix)</li><li>Padding</li><li>Rectified Linear Unit (RelU) (introduce non-linearity to the network)</li><li>Padding Layer (reduce number of parameters)</li><li>Fully Connected Layer (flatten matrix into vector and feed it to a fully connected neural network layer.)</li></ol><p>There are few architecture of CNN (some of the most common is ResNet, VGGNet), but in this post, I will use the ResNet50.</p><p>ResNet or Residual Network uses the residual learning instead of trying to learn some features. Residual can be simply understood as subtraction of feature learned from input of that layer. There are <a href="https://towardsdatascience.com/an-overview-of-resnet-and-its-variants-5281e2f56035">some variants of ResNet</a> other than ResNet50. The core idea of ResNet is introducing a shortcut connection that skips one or more layers.</p><p>ResNet50 has 50 layers deep, below is the architecture of ResNet50 with 34 layer residual. <a href="https://arxiv.org/abs/1512.03385">Here is the paper of the network</a> and here is <a href="https://towardsdatascience.com/understanding-and-coding-a-resnet-in-keras-446d7ff84d33">why ResNet is a good CNN architecture to be used</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/0*bBiMda6n_xKUCSnj.png" /><figcaption>Source: <a href="http://ethereon.github.io/netscope/#/gist/db945b393d40bfa26006">http://ethereon.github.io/netscope/#/gist/db945b393d40bfa26006</a></figcaption></figure><h3>Data</h3><p>I actually wanted to try Image Processing for my research but in that time there were so many people said that image training consumed too much time and memory, plus if you don’t have decent laptop/computer, it might be kind of impossible to do so. So I didn’t. But turned out, you could just use Google Colab. I don’t know how much time if I train it on my computer but with Colab it’s not that long like my friends had said.</p><p>If you wanted to access the data <strong>from Kaggle</strong>, you could just download the JSON API of your Kaggle account, upload to your Colab files then download and unzip the image data to your Colab environment.</p><pre>! pip install -q kaggle<br>! mkdir ~/.kaggle<br>! cp kaggle.json ~/.kaggle/<br>! chmod 600 ~/.kaggle/kaggle.json</pre><pre>! kaggle datasets download -d tawsifurrahman/covid19-radiography-database<br>! unzip &quot;covid19-radiography-database.zip&quot;</pre><p>You can also access data<strong> from your Google Drive</strong> with mounting your Colab session and access your image data location from the Drive.</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)</pre><p>If you want to access the data <strong>from an open source website</strong>, you can just use request library from Python. To take an example, here’s how to download 20GB data from Physio Net.</p><pre>import requests, zipfile, io</pre><pre>zip_file_url = &quot;https://physionet.org/static/published-projects/siena-scalp-eeg/siena-scalp-eeg-database-1.0.0.zip&quot;</pre><pre>r = requests.get(zip_file_url)<br>z = zipfile.ZipFile(io.BytesIO(r.content))</pre><pre>z.extractall()</pre><h3>Pre-Processing</h3><p><strong>Library</strong></p><p>Some libraries that I used</p><pre>from fastai.vision import *<br>from fastai.metrics import error_rate</pre><pre>import torch<br>import torch.nn as nn<br>import torch.optim as optim<br>from torch.optim import lr_scheduler<br>from torch.autograd import Variable</pre><pre>import numpy as np</pre><pre>import time<br>import os</pre><pre>from fastai.callbacks import ActivationStats<br>%matplotlib inline<br>import matplotlib.pyplot as plt<br>plt.style.use(&#39;seaborn-whitegrid&#39;)</pre><p><strong>Access the image from folder</strong></p><p>Define the folder path</p><pre>path = Path(&#39;/content/COVID-19 Radiography Database/&#39;)</pre><pre>folder = path</pre><pre>folder.mkdir(parents=True, exist_ok=True)</pre><p>Extract the <a href="https://dejanbatanjac.github.io/2019/03/15/ImageDataBunch.html">image data bunch</a></p><pre>np.random.seed(42)</pre><pre>data = ImageDataBunch.from_folder(path, train=&#39;.&#39;, valid_pct=0.35, ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)</pre><h3>Training with CNN Resnet50</h3><p>With fastai, we can instantly use the Resnet model by the function of cnn_learner. Don’t forget to define the accuracy metrics so that we can see the loss and accuracy.</p><p>To reduce time, I will just use four epochs.</p><pre>learn = cnn_learner(data, models.resnet50, metrics=accuracy)</pre><pre>learn.fit_one_cycle(4)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*nS09O6ztmQu4S2tDyjhTVw.png" /></figure><p>With the model, we can find the optimal learning rate to get the better performance. Unfreezing the model is used to let the model continue the training. In this case, unfreezing will let the model to train again with the better learning rate after we got the observation.</p><pre>learn.unfreeze()</pre><pre>learn.lr_find()<br>learn.recorder.plot(suggestion=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*NvsiyNohFXd6udXtLulw5Q.png" /></figure><p>Next training with better learning rate can train for just 2 epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*LPmw3XM0FerbjIcncTnqnQ.png" /></figure><h3>Result</h3><p>The very good thing that I really love using FastAI is that the model evaluation is so so easy. We can just interpret the classification model like the loss prediction, confusion matrix, most confused.</p><pre>interp = ClassificationInterpretation.from_learner(learn)</pre><pre>losses, idxs = interp.top_losses()</pre><p>First, we can plot the loss of prediction from the model.</p><pre>interp.plot_top_losses(9, figsize=(15,11))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBrWzyJMPBHDHO3i3Drs6w.png" /></figure><p>And then the Confusion Matrix.</p><pre>interp.plot_confusion_matrix(figsize=(12,12), dpi=100)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*hEchUz7Q3gO5caISRwgFlQ.png" /></figure><h3><strong>Conclusion</strong></h3><p>It’s very convenient to apply many AI methods now, especially with FastAI Image Processing. I think the most important thing to be on studying Machine Learning is to be creative, innovative and never stops learning new things!</p><p>Thank you for reading!</p><h3>More Source to Learn</h3><ul><li><a href="https://medium.com/@RaghavPrabhu/understanding-of-convolutional-neural-network-cnn-deep-learning-99760835f148">Understanding of Convolutional Neural Network (CNN) — Deep Learning</a></li><li><a href="https://www.kaggle.com/learn/deep-learning">Learn Deep Learning Tutorials</a></li><li><a href="https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson2-download.ipynb">fastai/course-v3</a></li><li><a href="https://github.com/Kulbear/deep-learning-coursera/blob/master/Convolutional%20Neural%20Networks/Residual%20Networks%20-%20v1.ipynb">Kulbear/deep-learning-coursera</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2a1fd77f5fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/image-classification-with-resnet50-convolution-neural-network-cnn-on-covid-19-radiography-d2a1fd77f5fb">Image Classification With ResNet50 Convolution Neural Network (CNN) on Covid-19 Radiography</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[Text Classification on Disaster Tweets with LSTM and Word Embedding]]></title>
            <link>https://medium.com/data-science/text-classification-on-disaster-tweets-with-lstm-and-word-embedding-df35f039c1db?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/df35f039c1db</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[lstm]]></category>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[text-classification]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Wed, 02 Sep 2020 08:15:00 GMT</pubDate>
            <atom:updated>2020-12-10T03:49:08.595Z</atom:updated>
            <content:encoded><![CDATA[<h4>Word Embedding on Text Classification accuracy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*1Rd11f-V0IRhHbYo.jpg" /><figcaption><a href="https://www.istockphoto.com/photo/disaster-area-with-tornado-gm172448852-23567577">https://www.istockphoto.com/photo/disaster-area-with-tornado-gm172448852-23567577</a></figcaption></figure><p>This was my first Kaggle notebook and I thought why not write it on Medium too?</p><p>Full code on my <a href="https://github.com/emmanuellaanggi/disaster_tweet_sentiment">Github</a>.</p><p>In this post, I will elaborate on how to use fastText and GloVe as word embedding on LSTM model for text classification. I got interested in Word Embedding while doing my paper on Natural Language Generation. It showed that embedding matrix for the weight on embedding layer improved the performance of the model. But since it was NLG, the measurement was subjective. And I only used fastText too. So in this article, I want to see how each method (with fastText and GloVe and without) affects to the prediction. On my Github code, I also compare the result with CNN. The dataset that i use here is from one of competition on Kaggle, consisted of tweets and labelled with whether the tweet is using disastrous words to inform a real disaster or merely just used it metaphorically. Honestly, on first seeing this dataset, I immediately thought about BERT and its ability to understand way better than what I proposed on this article (<a href="https://medium.com/@jonathan_hui/nlp-bert-transformer-7f0ac397f524">further reading on BERT</a>).</p><p>But anyway, in this article I will focus on fastText and GloVe.</p><p>Let’s go?</p><h3><strong>Data + Pre-Processing</strong></h3><p>The data consisted of 7613 tweets (columns Text) with label (column Target) whether they were talking about a real disaster or not. With 3271 rows informing real disaster and 4342 rows informing not real disaster. The data shared on kaggle competition, and if you want to learn more about the data you can read it <a href="https://www.kaggle.com/c/nlp-getting-started">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GHVI0YT6W97_kRULUWOFA.png" /></figure><p>Example of real disaster word in a text :</p><blockquote>“ Forest <strong>fire</strong> near La Ronge Sask. Canada “</blockquote><p>Example of the use of disaster word but not about disaster:</p><blockquote>“These boxes are ready to <strong>explode</strong>! <strong>Exploding</strong> Kittens finally arrived! gameofkittens #explodingkittens”</blockquote><p>The data will be divided for training (6090 rows) and testing (1523 rows) then proceed to pre-processing. We will only be using the text and target columns.</p><pre>from sklearn.model_selection import train_test_split</pre><pre>data = pd.read_csv(&#39;train.csv&#39;, sep=&#39;,&#39;, header=0)</pre><pre>train_df, test_df = train_test_split(data, test_size=0.2, random_state=42, shuffle=True)</pre><p>Pre-processing steps that used here:</p><ol><li>Case Folding</li><li>Cleaning Stop Words</li><li>Tokenizing</li></ol><pre>from sklearn.utils import shuffle</pre><pre>raw_docs_train = train_df[&#39;text&#39;].tolist()<br>raw_docs_test = test_df[&#39;text&#39;].tolist()<br>num_classes = len(label_names)</pre><pre>processed_docs_train = []</pre><pre>for doc in tqdm(raw_docs_train):<br>  tokens = word_tokenize(doc)<br>  filtered = [word for word in tokens if word not in stop_words]<br>  processed_docs_train.append(&quot; &quot;.join(filtered))</pre><pre>processed_docs_test = []</pre><pre>for doc in tqdm(raw_docs_test):<br>  tokens = word_tokenize(doc)<br>  filtered = [word for word in tokens if word not in stop_words]<br>  processed_docs_test.append(&quot; &quot;.join(filtered))</pre><pre>tokenizer = Tokenizer(num_words=MAX_NB_WORDS, lower=True, char_level=False)<br>tokenizer.fit_on_texts(processed_docs_train + processed_docs_test)  </pre><pre>word_seq_train = tokenizer.texts_to_sequences(processed_docs_train)<br>word_seq_test = tokenizer.texts_to_sequences(processed_docs_test)<br>word_index = tokenizer.word_index</pre><pre>word_seq_train = sequence.pad_sequences(word_seq_train, maxlen=max_seq_len)</pre><pre>word_seq_test = sequence.pad_sequences(word_seq_test, maxlen=max_seq_len)</pre><h3><strong>Word Embedding</strong></h3><p><strong>Step 1. Download Pre-trained model</strong></p><p>The first step on working both with <a href="https://fasttext.cc/docs/en/english-vectors.html">fastText</a> and <a href="https://nlp.stanford.edu/projects/glove/">Glove</a> is downloading each of pre-trained model. I used Google Colab to prevent the use of big memory on my laptop, so I downloaded it with <em>request </em>library and unzip it directly on the notebook.</p><p>I used the biggest pre-trained model from both word embedding. fastText model gave 2 million word vectors (600B tokens) and GloVe gave 2.2 million word vectors (840B tokens), both trained on Common Crawl.</p><p><strong>fastText pre-trained download</strong></p><pre>import requests, zipfile, io</pre><pre>zip_file_url = “https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M.vec.zip&quot;</pre><pre>r = requests.get(zip_file_url)</pre><pre>z = zipfile.ZipFile(io.BytesIO(r.content))</pre><pre>z.extractall()</pre><p><strong>GloVe pre-trained download</strong></p><pre>import requests, zipfile, io</pre><pre>zip_file_url = “http://nlp.stanford.edu/data/glove.840B.300d.zip&quot;</pre><pre>r = requests.get(zip_file_url)</pre><pre>z = zipfile.ZipFile(io.BytesIO(r.content))</pre><pre>z.extractall()</pre><p><strong>Step 2. Load Pre-trained model to Word Vectors</strong></p><p>FastText gave the format to load the word vectors and so I used that to load both models.</p><pre>embeddings_index = {}</pre><pre>f = codecs.open(‘crawl-300d-2M.vec’, encoding=’utf-8&#39;)<br># for Glove<br># f = codecs.open(‘glove.840B.300d.txt’, encoding=’utf-8&#39;)</pre><pre>for line in tqdm(f):</pre><pre>values = line.rstrip().rsplit(‘ ‘)</pre><pre>word = values[0]</pre><pre>coefs = np.asarray(values[1:], dtype=’float32&#39;)</pre><pre>embeddings_index[word] = coefs</pre><pre>f.close()</pre><p><strong>Step 3. Embedding Matrix</strong></p><p>Embedding matrix will be used in embedding layer for the weight of each word in training data. It’s made by enumerating each unique word in the training dataset that existed in tokenized word index and locate the embedding weight with the weight from fastText orGloVe (<a href="https://machinelearningmastery.com/use-word-embedding-layers-deep-learning-keras/)">more about embedding matrix</a>).</p><p>But there is a possibility that there are words that aren’t in the vectors such as typos or abbreviation or usernames. Those words will be stored in a list and we can compare the performance of handling words from fastText and GloVe</p><pre>words_not_found = []</pre><pre>nb_words = min(MAX_NB_WORDS, len(word_index)+1)<br>embedding_matrix = np.zeros((nb_words, embed_dim))</pre><pre>for word, i in word_index.items():<br>  if i &gt;= nb_words:<br>     continue<br>  embedding_vector = embeddings_index.get(word)<br>  <br>  if (embedding_vector is not None) and len(embedding_vector) &gt; 0:<br>     embedding_matrix[i] = embedding_vector<br>  else:<br>     words_not_found.append(word)</pre><pre>print(&#39;number of null word embeddings: %d&#39; % np.sum(np.sum(embedding_matrix, axis=1) == 0))</pre><p>Number of null word embeddings on fastText is 9175 and on GloVe is 9186. Can be assumed that fastText handle more words even when the pre-trained was trained on fewer words.</p><h3><strong>Long Short-Term Memory (LSTM)</strong></h3><p>You can do fine-tuning on hyper-parameters or architecture, but I’m going to use the very simple one with Embedding Layer, LSTM layer, Dense layer, and Drop out Layer.</p><pre>from keras.layers import BatchNormalization<br>import tensorflow as tf</pre><pre>model = tf.keras.Sequential()</pre><pre>model.add(Embedding(nb_words, embed_dim, input_length=max_seq_len, weights=[embedding_matrix],trainable=False))</pre><pre>model.add(Bidirectional(LSTM(32, return_sequences= True)))<br>model.add(Dense(32,activation=’relu’))</pre><pre>model.add(Dropout(0.3))<br>model.add(Dense(1,activation=’sigmoid’))</pre><pre>model.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Su4SgxSGwjMLMbo18kv_9Q.png" /></figure><pre>from keras.optimizers import RMSprop<br>from keras.callbacks import ModelCheckpoint<br>from tensorflow.keras.callbacks import EarlyStopping</pre><pre>model.compile(loss=&#39;binary_crossentropy&#39;, optimizer=&#39;adam&#39;, metrics=[&#39;accuracy&#39;])</pre><pre>es_callback = EarlyStopping(monitor=&#39;val_loss&#39;, patience=3)</pre><pre>history = model.fit(word_seq_train, y_train, batch_size=256, epochs=30, validation_split=0.3, callbacks=[es_callback], shuffle=False)</pre><h3>Result</h3><p>fastText gave the best performance with accuracy for about 83% while GloVe gave 81% accuracy. The difference on the performance isn’t so significant but to compare it with the performance of model without word embedding (68%), we can see the significant use of Word Embedding on embedding layer weight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*3-aFRQ2TKgcRqg0pNscH4w.png" /><figcaption>Accuracy with fastText Word Embedding</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*JS1rkGZcBdT68L_bv9F6yA.png" /><figcaption>Accuracy with GloVe Word Embedding</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*b65NAuBhcFQ2LfKgT6nP_Q.png" /><figcaption>Accuracy Without Word Embedding</figcaption></figure><p>For more about the training performance, detail code, and if you want to apply it on a different dataset, you can see the full code on my <a href="https://github.com/emmanuellaanggi">GitHub</a>.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df35f039c1db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/text-classification-on-disaster-tweets-with-lstm-and-word-embedding-df35f039c1db">Text Classification on Disaster Tweets with LSTM and Word Embedding</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[Machine Learning Explainability: E-Commerce Sales (Case Study)]]></title>
            <link>https://medium.com/analytics-vidhya/machine-learning-explainability-e-commerce-sales-case-study-7265168db40f?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7265168db40f</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[experiment]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Sat, 29 Aug 2020 15:22:57 GMT</pubDate>
            <atom:updated>2020-09-07T13:26:26.142Z</atom:updated>
            <content:encoded><![CDATA[<h4>Explaining ML with E-Commerce Sales dataset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*R1LvunAJg2sVm0sz.png" /><figcaption>Source : <a href="https://www.protranslate.net/blog/en/how-to-do-e-commerce-in-mena-mena101/">https://www.protranslate.net/blog/en/how-to-do-e-commerce-in-mena-mena101/</a></figcaption></figure><p>I’m going to share more of my learning in Data Science with my Medium, this way, I would be able to understand more with writing what I learned.</p><p>(Note: I am still learning and most of resources I read are in English, which is not my first language. So please correct me if I understood things wrong! Your correction will mean a lot to me😊)</p><p>This time I’m going to apply Machine Learning Explainability techniques that Kaggle provided in one of their free Machine Learning Courses to a different dataset.</p><p>The interesting dataset that I used here (<a href="https://www.kaggle.com/jmmvutu/summer-products-and-sales-in-ecommerce-wish">https://www.kaggle.com/jmmvutu/summer-products-and-sales-in-ecommerce-wish</a>) is about Sales of Summer clothes in E-Commerce Wish (<a href="http://wish.com/">wish.com</a>). The dataset provides product listings with various components including the ratings, sales performance, and many more features. Each component can tell the correlation.</p><p>One of the questions that’s provided in the dataset is the relationship between quality of a product in ratings, its price, and its success</p><p>I’m going to try applying the ML Explainability techniques to answer the question (and maybe look thoroughly?). Anyway, let’s go! I hope it’s insightful! :)</p><h3><strong>MACHINE LEARNING EXPLAINABILITY</strong></h3><p>The method on explaining Machine Learning is usually used to extract insights from the model. Gaining these insights can improve the performance of Machine Learning in the future to get best of the data. Like how to improve the model accuracy, how to effectively collect the data, how to make decision, prevent data leakage, and build trust as you can explain your model wholly.</p><h3><strong>1.</strong> <strong>Feature Importance</strong></h3><p>To see every impact of the features, I will use Permutation Importance. This method applied after the model has been fitted. The idea of this method is to see how much a column affected the prediction when the value of the column placed randomly. The steps to use Permutation Importance are train the model and then shuffle one column to make a prediction, look the loss function it suffered from the random placing, and then repeat the shuffling to another column.</p><p><strong>Step 1. Train the model</strong></p><p>You can try on more features, but I use some of the main features from the data like product and merchant rating, retail price and selling price, did the product uses ad boosts or not, international shipping availability, badges on each product (local product, product quality, and fast shipping), and whether the merchant has profile picture or not. The target I use here is how many units that the product sold. Random Forest will be the model the data trained on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlE-TRbJw8JbHv6aovBfGQ.png" /></figure><p><strong>Step 2. Using Permutation Importance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N92utYG0bqwlbiUTDRHOZQ.png" /></figure><p>We can import eli5 module to use Permutation Importance function. To elaborate what Permutation Importance did, it will first shuffle one column and get prediction. From this prediction, it will see how much loss function did it suffered from switching the value of that one column. This method will be repeated to other columns and then we can compare each loss function and see the weight of each feature in affecting the prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*WvBdUt_7c5ugxppX47TnLg.png" /></figure><p>Not surprising, rating — both from the product and the merchant — is the most important feature that people consider when buying, which also tells that product quality reviewed by costumer impact more than just a badge of quality. We can also see that international shipping availability is important too, which also tells that Wish has lots of international users. But isn’t it surprising that price isn’t affecting much than the reviews? People are looking for more quality than just price.</p><h3><strong>2. Partial Dependence Plot</strong></h3><p>Next is Partial Dependence plot. If permutation feature told us about what feature affects prediction the most, Partial Dependence Plot tells us <strong><em>how</em></strong><em> </em>it affected prediction. Just like Permutation, PDP used after the model is fitted.</p><p>In this method, I will use Random Forest model again but only use top important feature from the Permutation Importance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzEzIESIXMY7gYpSb6eL0A.png" /></figure><p>With this model, we can see the dependence with PDP by using pdpbox Library (<a href="https://github.com/SauceCat/PDPbox">https://github.com/saucecat/pdpbox</a>) to all the feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HAci0fm2DA2WLTqQyJgiw.png" /></figure><p>Note on the graphic (before we see the it): Y axis told about the change of prediction and the blue shade is the level of confidence.</p><p><strong>International Shipping</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdyqoPHs-noq2imCKB1a5A.png" /></figure><p>We can see that more countries that the product shipped to, there are more chance the product sell more.</p><p><strong>Price</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3QtNvYdzOFPmOLgmCtuUg.png" /></figure><p>Surprisingly, product high price products have higher chance to be sold more.</p><p>Rating</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04ggiWsEjVQyqZvMKHyn5Q.png" /></figure><p>On Rating, we can see that there is no particular impact on selling but it’s shown that product with low rating has low chance in selling.</p><p><strong>Merchant Rating</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mAnC9g3kqrus5Z0hBAXAWA.png" /></figure><p>Merchant rating impacts more than I thought it would be, the higher the rating, the more customer confident to buy the product. Customer usually be confident if the merchant’s rating is 4.0 minimum.</p><p>And not just the importance of a feature, we can also see how the interaction between two feature effect on the unit sold. I’ll try on the interaction between rating and price.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEq6FgaIowO8nOKW412q1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*8LQqsz6WU43Hyi9qUUH2yw.png" /></figure><p>We can see that a product even though has low price, it’d be unlikely to be easily sold. It’s funny that most product with low price didn’t sell well, I guess people are looking from more quality by the price for summer?</p><h3><strong>3. SHAP (Shapley Additive explanations)</strong></h3><p>The last one would be SHAP. What SHAP do is breaking down the impact of each feature that used to predict. I once tried SHAP on Image Processing and it capable to tell which position on the image has big influence to the result. This method would help the most on medical image to tell where precisely from the part of the organs image’s anomaly that cause a disease. More about SHAP can be learned here: <a href="https://towardsdatascience.com/one-feature-attribution-method-to-supposedly-rule-them-all-shapley-values-f3e04534983d">https://towardsdatascience.com/one-feature-attribution-method-to-supposedly-rule-them-all-shapley-values-f3e04534983d</a>.</p><p>In this case, SHAP able to tell how each factor lead to the prediction. Example, I took one row of the validation set that has feature like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*0mxGW8tutGyFC3FsHWS09g.png" /></figure><p>With this row, the prediction probability of product selling is at 0.63. I will apply SHAP to explain how each feature affecting the prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Po6qy_5XiIvkfUtisLhARA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CM87sZV-Ev0XaoRHE4V5PA.png" /></figure><p>Feature values causing increased predictions are in pink, and their visual size shows the magnitude of the feature’s effect. From the graph, the most important factor that leads to the prediction is Merchant Rating, followed by number of international shipping and rating, the price affected just a little.</p><p>More advance, SHAP can tell the importance of every feature in a summary plot. In this step, I will use the Validation Set to get prediction. Each value of the Validation Set represented by three characteristics of the dot. The vertical shows what feature, the color shows whether it’s high or low on that row, and the horizontal shows whether the effect of that value caused a higher or lower prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*6guw9eZMDR_clTainxLawA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqcFVAM1gR5Uul0smsK2MQ.png" /></figure><p>There are so much information that can be extracted from the summary plots above. But two that so obvious is that the low rating and high international shipping availability affected so much on the prediction output.</p><p>At last, ML Explainability techniques gave so much convenience to improve the model. As in this case, to improve more on the selling, the merchant can focus on improving the feature that impact the most like customer satisfaction and international shipping. They could build more trust to the customer so the merchant rating can improve as it’s also one of the most importance feature.</p><p>You can find the full code on my Github : <a href="https://github.com/emmanuellaanggi/machine-learning-explainability-of-ecommerce-sales">https://github.com/emmanuellaanggi/machine-learning-explainability-of-ecommerce-sales</a></p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7265168db40f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/machine-learning-explainability-e-commerce-sales-case-study-7265168db40f">Machine Learning Explainability: E-Commerce Sales (Case Study)</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Teaching Helps Me Learning Data Science (Data Science Beginner)]]></title>
            <link>https://emmanuellaanggi.medium.com/how-teaching-helps-me-learning-data-science-data-science-beginner-7880523ed952?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7880523ed952</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[teaching-and-learning]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Thu, 30 Jul 2020 01:42:19 GMT</pubDate>
            <atom:updated>2020-08-30T04:05:14.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UtQ2_itRy1Ku4j1mcNpQFA.jpeg" /><figcaption>source: Pexels</figcaption></figure><p>The one thing that I know about data science as I’m getting into it is that it requires a lot of learning. There is always something I haven’t learn, be it the algorithm, the programming language, the statistic stuff, the method. Every part of working with data isn’t just a one time learning.</p><p>When I was just getting into it for few months, I got an offer to assist my lecturer on hands-on of her machine learning class (sooner also the artificial intelligence class). As a very anxious person, I thought that I didn&#39;t deserve to teach something that I didn&#39;t master myself. But to be actually teaching it, it eventually helped me learning it than if I didn&#39;t teach it. With teaching data science, instead of helping others, I found it’s helping me more.</p><p>Based on <em>my</em> experience, here’s why:</p><h3><strong>1. There’s always new question from different perspectives</strong></h3><p>This is a classic advantage of teaching. Well, everything seemed classic anyway. As I dived more into data science, learning from your own perspective will never be enough. Data tells a lot more than it seemed.</p><p>Learning perspectives taught me different places to <em>start </em>when I got a data and how to handle the conclusion. When teaching the basic thing like understanding the structure and pre-processing, there were a lot of question about why we needed that. And every time I answered it with my own perspectives, someone will ask or give their own opinion. And I got to learn more for my understanding. And there are so many parts that needs more understanding with data science. Knowing the basic data structure in Python doesn’t mean I understand fully when I got lots questions from different perspectives and problems. The different problems made me realize that I will not always in best case. And to be aware of every errors and incompatibilities is so needed.</p><p>Working with data is, I think, more than just code. It’s more being a bridge between the data and the people.</p><h3><strong>2. Makes you master a topic</strong></h3><p>I taught Python basics more than six times. I am actually kind of sick about it. But yes, it’s very very needed. So far, Python is my favorite programming language to work with data. And based on my knowledge, Python provided almost complete algorithm, library to pre-process the data, and tools to visualize the conclusion. Every time I taught; I have to learn it the night before. Each class had their own understanding so I have to fit myself to their starting point. And every time I prepared what I wanted to teach, there would be new sources. So, I got six times more understanding of python basics!</p><p>It gets more interesting as I started to teach the algorithm. Having to learn it again and again made me realised how important it is to fully understand how the algorithm works, not just the surface of it. It made me more confident to choose what method I want to apply to my data as I understood the theory of it. I guess data science is more about understanding each part of it. Without the understanding it felt like working blindly.</p><h3><strong>3.</strong> <strong>Confidence</strong></h3><p>Working with data is also about telling people what you understand from those numbers, patterns, statements, etc etc. Before having comfortable to talk about what I got to the data, I think it’s really important that I understand what I used. Every theory is needed. And not only theory, the <em>confidence </em>is very important. I am a very anxious person, but having to teach in front people I didn’t know, gave me lots of confidence. I became comfortable with questions and my presence. And without worrying about presenting you data, for me data science became more and more <em>my thing</em>.</p><h3><strong>4.</strong> <strong>Gift of giving</strong></h3><p>When you started to give, everything seemed to be more <em>meaningful. </em>Yes I know it’s cringe.</p><p>If I studied in library for hours, when I got home there was of course the satisfaction I had of knowing more things. But with teaching, it’s not only satisfaction I got, it’s knowing that I am sharing something. It’s the emotion, the rewards of spending nights studying for something I will teach. The satisfaction of knowing that probably, what I taught meant something to somebody and led them to a path. The most beautiful thing of teaching is when someone made me their role model and to every achievement I got, they always said that I made them proud. It’s an emotion that I can never explain but surely the thing that kept me going on with what I learn. It’s such a cool thing to have a reward for studying!</p><h3><strong>5.</strong> <strong>It’ll never bore you</strong></h3><p>It will never bore you. My reason when I was first getting into data science was as simply as it works with number. But when I put one step in, I also learned that only understanding number will not get you anywhere further. Data science is so broad. When explaining the importance of data, I got to learn a lot. And to discuss with my class what they saw from the data and how they perceive the trend, made me eager on learning more. Even in the same topic, learning new things will never make me bored. The discussion made it even more interesting.</p><h3><strong>6.</strong> <strong>You’ll find yourself loving it more</strong></h3><p>Seeing another people enjoy what you enjoy is so satisfying. It made me understand that data science isn’t only interesting to me, but to each class I taught. Seeing them eager to know more and even learn more than I did, made me know that it was never a mistake or a waste of time to learn data science. And it’s not just my education phase, it’s for more ahead of me.</p><p>This writing was prepared last year when I taught so many classes. When the pandemic started, there were few classes that were postponed and I hadn’t teach ever since. The immediate effect was actually kind of making me unease. To be honest, when I wasn’t obliged to learn it, my study time reduced and I just learned what I wanted to learn. I indeed really miss teaching! Right now, I just share discussions to my friends but it’s still very important for my knowledge growth.</p><p>So, as people are more excited to learn new things now, if you can teach data science to your friends, no matter how basic it is, don’t hesitate to start to! Its always a good thing to share :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7880523ed952" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Twitter Bot on News Summarization]]></title>
            <link>https://blog.chatbotslife.com/how-i-built-my-very-first-twitter-bot-thats-surprisingly-enjoyable-783e2196b328?source=rss-2b61d2c09f4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/783e2196b328</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[twitterbots]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[Emmanuella Anggi]]></dc:creator>
            <pubDate>Sat, 05 Oct 2019 13:31:26 GMT</pubDate>
            <atom:updated>2020-08-30T04:01:49.059Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*vfz5lzxcs9UICnZw" /><figcaption><a href="https://theconversation.com/newspapers-are-dying-but-long-live-the-news-19106">https://theconversation.com/newspapers-are-dying-but-long-live-the-news-19106</a></figcaption></figure><p>When last semester’s started, I felt like I wasn’t enjoying my time in college much. As a Computer Science student, I was very concerned that I never really tried building something by my own. Instead, I was even eager to be in Twitter, scrolling down to news, and criticizing almost everything.</p><figure><img alt="https://cdn-images-1.medium.com/max/1200/0*imC4uWXu6S5TUFgt.jpg" src="https://cdn-images-1.medium.com/proxy/0*imC4uWXu6S5TUFgt.jpg" /><figcaption>literal illustration of me working on every college assignment</figcaption></figure><p>But then I thought:</p><p><em>couldn’t I be eager both on what I like and what I studied to?</em></p><p>After questioning myself, I decided to try on creating a Twitter <a href="https://chatbotslife.com/">Bot</a> that mix what I am passionate in:</p><p>1. Twitter,</p><p>2. Journalistic, and</p><p>3. Python Programming.</p><h3>Top 4 Most Popular Bot Design Articles:</h3><blockquote><a href="https://chatbotslife.com/bots-super-personalization-on-steroids-8cd4ee3a9e8b">1. Bots &amp; Super Personalization On Steroids</a></blockquote><blockquote><a href="https://chatbotslife.com/one-metric-one-platform-and-one-vertical-4b763e2eb442">2. One metric, one platform and one vertical</a></blockquote><blockquote><a href="https://chatbotslife.com/chatbots-the-rise-of-conversational-ui-8a59078e2f95">3. ChatBots — The Rise of Conversational UI</a></blockquote><blockquote><a href="https://chatbotslife.com/7-tips-on-building-chatbots-for-your-brand-f2817bc33f09">4. Seven Tips on Building Chatbots for Your Brand</a></blockquote><p>I came across <a href="https://twitter.com/merangkumberita">a really good bot</a> once. Working as a bot that replied to a news account and summarize the news. Here’s the illustration of how the bot worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCv9X4IJxe97shlJZiwM6A.jpeg" /><figcaption>thanks Canva for the cute template</figcaption></figure><p>I found it very interesting because simply it:</p><p>1. avoid you from clicking on a click-bait news and</p><p>2. avoid misinformation from an unclear headline.</p><p>I was once very excited about the <a href="https://chatbotslife.com/">bot</a> but too bad it’s not activated anymore. I tried to contact <a href="http://twitter.com/bitxt">the creator</a> about the account and looked for <a href="https://github.com/gitfarhan">his GitHub</a> if just in case he ever published the source code but I found none.</p><p>So! I tried to recreate the bot with my very own approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*3RtoHOdeh4dDqYHOX-Id3Q.png" /><figcaption>another literal illustration, this time of how my code works</figcaption></figure><p>*<em>please note that I am a very messy learner with a chaotic mindset; at least it works.</em></p><p>I learned and collected few How-To-s that I should prepare before jumping in:</p><p>1. Connects to Twitter API to take the Link from Tweets</p><p>2. Retrieves news article content from the Link with scrapping tools and restore it to JSON format</p><p>3. Summarizes the data</p><p>4. Converts the summarized article in JSON to an image.</p><p>5. Reply the image to the user.</p><p>So after that I collected every functions for those (<em>yes, this ineffective) </em>and put the puzzles together.</p><p>Here, I elaborate every steps:</p><h3>1. Connect to Twitter API + take a link from a mentioned tweets.</h3><p>This is very easy, I discovered. First thing first, I need to make sure my Twitter account applied to Twitter Developer account to get token and access to the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*B31exkyKtUcKTUBtcfM7WA.png" /></figure><p>Once the appliance to Twitter Developer is accepted, I can get my keys and token, and im good to proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*iS5HvOu98PzgpmPYwRSY4Q.png" /></figure><p>Accessing Twitter API with Python is simple. Simply import <em>Tweepy</em> to the program and create a new Python file that restore the key from Twitter.</p><p>On the separated files, put the Consumer Key, Consumer Secret Key, Access Key, and Access Secret Key from Twitter Developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*4_bZsp4TzcJdsbPFSp6upA.png" /></figure><p>On the main file, import Tweepy and the constant file and access the authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*61_XmO-kxZelh9nJ8sxxUQ.png" /></figure><p>With this, I can already use every feature in the Tweepy modules! Next!</p><h3>2. Retrieves news article content from the Link with scrapping tools</h3><p>After accessing Tweepy, I proceed to discover how to get the link from a tweet that mention to the account.</p><p>I put the method in a separated function (sounds weird but you got me) and the method will take the mentions. By the rules of Tweepy, the <em>api.mentions_timeline() </em>will take 20 mentions but since I only need the latest one, I filter it by restore the ones I already used an take the other one after that (the id is created automatically in order, descending).</p><p>After that, I restore it to a separate file which I named last_seen_id.txt and will be used as the reference to the next latest id mentions.</p><p>After getting the tweets with certain ID I need, I need to make sure that the tweets I received is only contained with link. So I count on Regex for that.</p><p>Voila, here’s the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*VrFpgWRHk4TrrxksN735yQ.png" /></figure><p>So the one link’s that will be proceed will go to the next step:</p><h3>3. Take the article out of the link with scrapping tools</h3><p>I tried several scrapping tools for this and decided that Scrappy is my favorite (this one works first). I don’t really understand how I finally get the function done (oh well) but here’s the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*ATi5FEqZJ9MWjuvdzrC0Qw.png" /></figure><p>I really filter the content so recklessly and ineffective but anyway.</p><p>This step scrapped the content from the title, the body, and remove tags that’s not needed to the summarization. I took it based on their div name from the HTML. The reason why I limited the sources was because it’s easier to set the section from the HTML since different source means different HTML structure.</p><p>All of it restored in a list so in the variable <em>content </em>I put the needed and unneeded things and remove the unneeded using for loops.</p><p>The content I need is dumped to a JSON file.</p><p>This is the most crucial and hardest part I guess, so after this, I got pretty eased. The remained steps were fun!</p><h3>4. Summarize the article</h3><p>After got the data from all the scrapping things and restore it to JSON, all I have to do to summarize it (surprisingly) just import a library called <em>Gensim </em>and apply the summarization function to the text.</p><p>It works pretty good and satisfying. The text is in Indonesian but even if you don’t understand it I can guarantee it worked well enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*sx4uTAIteg-JrZuZz2tHxQ.png" /><figcaption>Text before summarized</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*gEH7ieEziVx0QHoxjxVq8g.png" /><figcaption>The text after being summarized with Gensim</figcaption></figure><p>And the code was just</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*jWNDrZ3k3jvNfIIe2b0V8A.png" /></figure><h3>5. Convert it to a picture</h3><p>This one too is actually pretty easy. After the text is already set up, I just need a background picture to put it on. The library I use for this is: <em>Pillow.</em></p><p>Here’s how it looked .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*8O5wa7g84L4ONYexUMGfHA.png" /></figure><p>As the text was pretty long, I used <em>Text Wrap </em>library to wrap the text nicely. The picture will be save to a new jpeg file and I apply that picture to the function <em>tweetit.</em></p><p>Here’s to elaborate the code:</p><h3>6. Reply the image to the user</h3><p>I’m using another function from Tweepy to reply directly from the account that mention me first. The id of the tweet taken from the latest ID I put on the last_seen_id.txt. And then it sends a confirmation that its already been sent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*DkPQUos9BQ_sW9_60MsmgQ.png" /></figure><p>So voila that was it. I also used <em>twisted.reactor </em>for the looping so the Scrappy can run in loop by itself. Although I think it’s still not really effective and really heavy and the program gives up too easy after some looping (like me) but yeah.</p><p>So,</p><p>It’s really simple yet really amused me for some reasons. I bet my explanation seems so off and a bit stupid as my codes. But here’s <a href="https://github.com/emmanuellaanggi/ringkas_berita">my full code on my GitHub</a>.</p><p>I hope this simply encouraging for a beginner like me to start and making programs with Python cause it’s quite simple. And it really felt as if I’m creating an art.</p><p>Thank you for reading!</p><h3>Don’t forget to give us your 👏 !</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*ZxaGcKC3UQEydQIX" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e59ef%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F3e59ef&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252F3e59ef%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7078d8ad19192c4c53d3bf199468e4ab/href">https://medium.com/media/7078d8ad19192c4c53d3bf199468e4ab/href</a></iframe><figure><a href="https://chatbotslife.com/bot-communities-mastermind-group-d2dae9876709#.53x0py6ou"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*6XUspT9JOSq0w0Fi35HIaA.png" /></a></figure><figure><a href="https://m.me/ChatbotsLife"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*c1LDMH5vbnIz9rmAka8Hwg.png" /></a></figure><figure><a href="https://chatbotslife.com/chatbot-development-hire-top-ai-chatbot-developers-c8b45ef7f207"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*D0Jf3dI6ZThtqcfwDYY7mg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=783e2196b328" width="1" height="1" alt=""><hr><p><a href="https://blog.chatbotslife.com/how-i-built-my-very-first-twitter-bot-thats-surprisingly-enjoyable-783e2196b328">Twitter Bot on News Summarization</a> was originally published in <a href="https://blog.chatbotslife.com/">Chatbots Life</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>