<?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 Jordan Tan-say on Medium]]></title>
        <description><![CDATA[Stories by Jordan Tan-say on Medium]]></description>
        <link>https://medium.com/@jordanbtansay?source=rss-dbb88fffd96d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Dz8ly2u8Tbp1jOSx</url>
            <title>Stories by Jordan Tan-say on Medium</title>
            <link>https://medium.com/@jordanbtansay?source=rss-dbb88fffd96d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:21:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jordanbtansay/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[An Analytical Look Into Deep-Q Networks (DQNs)]]></title>
            <link>https://jordanbtansay.medium.com/an-analytical-look-into-deep-q-networks-dqns-a53ca5114f11?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a53ca5114f11</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-q-learning]]></category>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Sat, 05 Mar 2022 09:27:50 GMT</pubDate>
            <atom:updated>2022-03-05T09:27:50.433Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*E0G6Y8RPFEQq6KDm" /></figure><h3>Introduction</h3><p>Recently, at my time in Dominican University of California (formerly Make School), I learned a lot about a multitude of different complex algorithms. Algorithms such as Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) to Long Short Term Memory Networks (LSTMs) and Generative Adversarial Networks (GANs) each serve a different purpose within Deep Learning and all hold their own importance within the field; however the ones that caught my attention today, like many other AI laboratories in recent years, are Q-learning algorithms–specifically Deep-Q Networks (DQNs).*</p><p><em>*As a disclaimer, within this article I will write an analysis of DQNs which will touch upon a paradigm of Machine Learning known as Reinforcement Learning. This will assume that readers have a basic understanding of how Reinforcement Learning works.</em></p><h3>Technical Overview</h3><p>Q-learning serves as a model-free reinforcement learning algorithm that learns the value of an action in a particular state.¹ The process of learning the value of an action is improved on iteratively through what is called a Q-table which comprises optimal scalar values of an action-value function Q, that effectively represents how good-bad it is to take an action at a particular state. DQNs are a type of Q-learning algorithm that applies simple neural networks to approximate Q-values and optimize our value function based on state data instead of creating an infeasible deterministic table for potentially billions of state parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EOY38XEXh_2_hWDCyhS1WA.png" /><figcaption>Architecture of a Q-Table</figcaption></figure><h4>Developmental History</h4><p>With the rising interests in neural networks beginning in the mid 1980s, the idea behind Q-learning was first developed by Chris Watkins in 1989 when he extended and integrated prior work from the previous insights of reinforcement learning research at the time. By the time of Watkins’s work there had been tremendous growth in reinforcement learning research, primarily in the machine learning subfield of artificial intelligence, but also in neural networks and artificial intelligence more broadly. In 1992, the remarkable success of Gerry Tesauro’s backgammon playing program, TD-Gammon, brought additional attention to the field.² It wasn’t until 2012 when there would be an increased interest in using deep neural networks as function approximators across a variety of domains and in 2015 the DQN algorithm that we know today would be developed by Google DeepMind.</p><h4>Domain Use Cases</h4><p>According to TensorFlow’s “Intro to RL and Deep Q Networks”, The original DQN that was created by DeepMind was “able to solve a wide range of Atari games (some to superhuman level) by combining reinforcement learning and deep neural networks at scale.”³ These DQNs would be utilized in creating AlphaGo (a program trained with deep RL to play Go), AlphaZero (a program trained with the same algorithm to play Go, chess, and shogi), and a number of other game playing computer programs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R_kMM-FSm5gcGXMZ" /><figcaption>Artist’s representation of AlphaZero provided by Google DeepMind</figcaption></figure><p>Deep reinforcement learning has also been applied to many domains beyond games. In robotics, it has been used to let robots perform simple household tasks and solve a Rubik’s cube with a robot hand. Deep RL has also found sustainability applications, used to reduce energy consumption at data centers. Deep RL for autonomous driving is an active area of research in academia and industry. Loon explored deep RL for autonomously navigating their high-altitude balloons.⁴</p><h4>Insights from the Architecture</h4><p>The groundbreaking feature of DQNs involves the usage of a deep neural network and a technique called experience replay. As stated within the technical overview section, creating a deterministic table for potentially billions of state parameters is not feasible so DQNs create what are called function approximators in the form of a neural network to create our Q-values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*kEr6ja5QVpw80xTHbJB3GA.png" /><figcaption>Architecture of a function approximator in the form of a neural network</figcaption></figure><p>Referencing TensorFlow’s tutorial again, experience replay is used “to avoid computing the full expectation in the DQN loss, we can minimize it using stochastic gradient descent. If the loss is computed using just the last transition , this reduces to standard Q-Learning.” For instance, the Atari DQN work used this technique at each time step of data collection by adding transitions to a circular buffer called the replay buffer. Then during training, instead of using just the latest transition to compute the loss and its gradient, we compute them using a mini-batch of transitions sampled from the replay buffer. This has two advantages: better data efficiency by reusing each transition in many updates, and better stability using uncorrelated transitions in a batch.³</p><h3>Ethical Review</h3><p>Within the excitement surrounding deep RL and Deep-Q Networks, especially with the most modern projects involving more consequential circumstances such as autonomous driving, there needs to be an emphasis on ethically responsible development, integrating ethics affects nearly every part of the data design process, which mainly involves the explainability, transparency, and robustness of our programs. Firstly, the idea behind the opacity of AI systems have been centered around “black box engineering”; however, many experts are calling for reform and a push towards explainable AI due to how prone black box algorithms can be to biases, errors, poor assumptions, &amp; confounding variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/0*rhSApmbcl5OJbNlB" /><figcaption>Conceptual image of “black box engineering”</figcaption></figure><p>The idea that DQNs use neural networks–which are incredibly complex–to formulate Q-values that allow our agents to choose the best action makes explainability much more important; the idea that we, observers, cannot understand how our programs run to achieve our desired outcomes will eliminate the trust that people can place on our programs on making the morally correct decision in an ethical dilemma which brings up the importance of robustness and artificial moral agents. Even more precise and tantamount is the design and development of machine intelligences as artificial moral agents: systems that can not only evaluate and make ethical choices in limited-information environments, but also apply that information theory to better capture environmental intelligence and improve productivity and receptivity. These are just a few of the many important questions that engineers face when dealing with every new and more powerful algorithm such as DQNs.</p><h3>Programmatic Introduction</h3><p>Written in Python, below is some sample code written by Aakash Sudhakar (my professor at Dominican University of California) and his team of teaching assistants which showcases the usage of DQNs to train a game-playing bot to train a race car on any input track.⁵ The block below showcases the creation of a FeedForward Neural Network as the DQN’s deep learning tool of choice in training our race cars.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFdGtrJfE8JMQdjjU3EQLw.png" /><figcaption>Code block showcases the model and agent creation process using the NEAT library</figcaption></figure><p>In this next code block, we ask our agents to generate their Q-values for each possible action within the output variable on line 93 which accesses their neural network. This is the DQN at work as it uses deep learning to assess which action to take next. It then takes the action with the highest Q-value on line 94 and implements their action through if-else statements on line 103–line 111 ranging from turning right/left or deceleration/accelerating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JTuErk1AQ-eCs-zaZTiBRg.png" /><figcaption>Code block represents the generation of Q-values for our actions and our action pool</figcaption></figure><p>The program then hands out rewards based on the status of the agent: if the race car crashed, then they stop gaining rewards, but if the race car is still on the track, then they gain a reward equal to the distance they traveled after their action. This reward will then be used to update their model and increase their ability to drive on the track faster and more accurately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5gcbFNCVDfsHB-gJDBtIOQ.png" /><figcaption>Code block represents the rewards system</figcaption></figure><h3>Conclusion</h3><p>Without a doubt, Deep-Q Networks provides a wider usage of the Q-learning algorithm allowing DQNs to be used today and in the future. From the humble beginnings of Reinforcement Learning as a pure concept towards creating Artificial Intelligence to the current importance that it holds now that Google DeepMind has continued to create more and more programs that reach top headlines on major news outlets for their respective discipline, DQNs stand as an important step towards allowing deep learning to reach its full potential in more impactful applications in what was thought to be impossible just a few decades ago.</p><p>[1]: Satwik Kansal, Brendan Martin. (July 11, 2018) <a href="https://www.learndatasci.com/tutorials/reinforcement-q-learning-scratch-python-openai-gym/">https://www.learndatasci.com/tutorials/reinforcement-q-learning-scratch-python-openai-gym/</a></p><p>[2]: Mark Lee. (January 4, 2005) <a href="http://incompleteideas.net/book/ebook/node12.html">http://incompleteideas.net/book/ebook/node12.html</a></p><p>[3]: Tensorflow. (December 8, 2021) <a href="https://www.tensorflow.org/agents/tutorials/0_intro_rl">https://www.tensorflow.org/agents/tutorials/0_intro_rl</a></p><p>[4]: Wikipedia. (January 29, 2022) <a href="https://en.wikipedia.org/wiki/Deep_reinforcement_learning">https://en.wikipedia.org/wiki/Deep_reinforcement_learning</a></p><p>[5]: Aakash Sudhakar, Zain Raza, Gobind Puniani, Hani Jandali. (February 23, 2022) <a href="https://github.com/AakashSudhakar/reinforcement-racer">https://github.com/AakashSudhakar/reinforcement-racer</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a53ca5114f11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a News Aggregator Using Natural Language Processing(NLP)]]></title>
            <link>https://jordanbtansay.medium.com/making-a-news-aggregator-using-natural-language-processing-nlp-5b42f6dc7e1b?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b42f6dc7e1b</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[news-aggregator]]></category>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Fri, 08 Oct 2021 22:55:29 GMT</pubDate>
            <atom:updated>2021-10-09T00:00:30.746Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Tutorial in Creating an NLP Model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eybCd6B11HZ_8-udoACW-g.jpeg" /><figcaption>Source: Pixabay</figcaption></figure><p>In this article, I’ll be explaining my process in creating a <a href="https://github.com/RogueNPC/NLP-News-Aggregator/blob/main/project/Capstone_News_Aggregator.ipynb">Natural Language Processing (NLP) news aggregator</a> which will help our computer parse through news headlines and filter them into one of two categories: Political or Non-political.*</p><p><em>*As a disclaimer, this project was originally supposed to organize these news headlines into their original classification involving at least 13 different categories (ranging from Entertainment to Sports to World Events, etc.) however due to limitations which we will be going over at the end of this article, this model will only document categorizing between Political or Non-political — because that’s all that really matters.</em></p><p>Although, before we get into the news aggregator, I should first explain what Natural Language Processing even is!</p><h4>Natural Language Processing</h4><p>According to IBM, “Natural language processing (NLP) refers to the branch of computer science — and more specifically, the branch of artificial intelligence or AI — concerned with giving computers the ability to understand text and spoken words in much the same way human beings can.” Even if we’ve never heard of NLPs, they exist in almost everything we do and can be used in a number of different ways including</p><ul><li>Translation</li><li>Autocorrect</li><li>Autocomplete</li><li>Conversational AI</li><li>Automated speech/voice recognition</li><li>And much more!</li></ul><p>This project isn’t any different as we’ll also be training a model to understand text and spoken words much like us humans. Now that we know just how important NLPs are, we can dive right into the news aggregator!</p><h3>Making the News Aggregator</h3><h4>Basic Imports</h4><p>First thing’s first, I started off by including all the general imports I would be using for the project which involves <a href="https://pandas.pydata.org/"><strong>pandas</strong></a> (our main data analysis library), <a href="https://matplotlib.org/"><strong>matplotlib</strong></a> and <a href="https://seaborn.pydata.org/"><strong>seaborn</strong></a> (for creating data visualizations), <strong>wordcloud </strong>(to create NLP specific visualizations), <a href="https://scikit-learn.org/stable/"><strong>sklearn</strong></a> (our main machine learning library), and most importantly <a href="https://www.nltk.org/"><strong>(Natural Language Toolkit)NLTK</strong></a> (a popular open-source package in Python that provides for all common NLP tasks).</p><h4>Data Loading and Preprocessing</h4><p>After imports, I then loaded our training dataset. The dataset that I worked with involved real-world text data provided by <a href="https://www.kaggle.com/rmisra/news-category-dataset">Kaggle</a> which included corpuses of news articles from the year 2012 to 2018 obtained from HuffPost. It’s with this dataset that I’ll be applying (long short-term memory) LSTM networks and attempting to determine whether each article is political or non-political from their headlines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gk0PXVgjvRzqoKDmbwTjXg.png" /><figcaption>Kaggle dataset stats</figcaption></figure><p>As we can see, our dataset is huge! We have about 100,000 different news articles and 41 different categories, not to mention the number of articles per category is extremely disparate!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*-xuyk1xxn1QpApeM7Ojjkw.png" /><figcaption>Dataset after simplification</figcaption></figure><p>To create an unbiased model that won’t take multiple hours to run, we’ll simply our dataset by making every category even except our “Politics” category and adding them up to create our “Non-politics” category which ended up looking like this. Afterwards, I eliminated the unneeded information such as authors and content, and proceeded to track only headlines and categories.</p><h4>Language Processing for Data Ingestion</h4><p>First thing to do now that we have our dataset extracted is to clean up as much erroneous information from our headline data in order to make our patterns and target labels as explicit and non-noisy as possible</p><p>These antipatterns include the following:</p><ul><li>Variances in syntactic capitalization.</li><li>Symbols and other non-alphanumeric cases.</li><li>Non-signal-related digits and numbers.</li><li><strong>Stop Words</strong>: generally noisy terms and tokens.</li><li>Different inflections of words that could be interpreted differently.</li></ul><p>After clean up, our dataset looked something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lnrewwP-PRMFdDLoRi-Waw.png" /><figcaption>Processed dataset in tabular form</figcaption></figure><p>As we can see from above, our dataset will now only contain signal-expressive terms as well as their corresponding category.</p><p>Before we get to modeling, however, let’s do some more sanity checks and peek into what the model thinks about our dataset.</p><p>First thing we’ll do is create a word cloud: a visualized format of conceptualizing the most frequent term occurrences in our headlines to better understand our tokenized distribution. The larger the word, the more common the term is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*NCo0IXCOmuot3QtSxue6XQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*5GQhsNHpsfkSd1zHmv1g1A.png" /><figcaption>(left) word cloud describing entire dataset, (right) word clouds describing each category</figcaption></figure><p>Looking good! We can see from above, the main word cloud describing our dataset as well as the two differing word clouds for both the non-politics and politics categories. Notice that even in the category of non-politics, we still see “trump” right under “photo” as a common word. We can keep that in mind as that might play a part in hindering the performance of our model, for instance, if our model comes across the word “trump”, it might be confused whether or not that article belongs in politics or non-politics. If it wasn’t for these word clouds, we might not have been able to identify this!</p><p>As we move on, we need to ready our processed data in a way for our machine to understand them. As it stands, our machine cannot comprehend what “POLITICS” means or any other category for that matter, however we can use a <strong>label encoder</strong> to properly vectorize our target categories essentially turning our targets into 1s and 0s like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*SfNKhDd_XxkDRgJCRGnaKA.png" /><figcaption>Label-encoded dataset in tabular form (0s meaning non-politics and 1s meaning politics)</figcaption></figure><p>Superb! Now that our categories are properly tokenized and ready for data ingestion, we can do the same for our actual input data: the headlines. For that, we’ll use a tokenizer object provided by NLTK.</p><pre>array([[  0,   0,   0, ..., 495, 127,  32],<br>       [  0,   0,   0, ...,   0,  28,  44],<br>       [  0,   0,   0, ..., 179, 281,  61],<br>       ...,<br>       [  0,   0,   0, ...,   0,  24,   9],<br>       [  0,   0,   0, ...,  90, 396, 250],<br>       [  0,   0,   0, ...,   0, 108, 232]], dtype=int32)</pre><p>We can see from above that our data has been properly tokenized and now all our text-based headlines have been transformed into digestible, frequency-based models for our machine to train with.</p><p>Last but not least, we setup our target labels to be ingestible as well and perform our train-test-splitting to generate the datasets that our model will train-test with.</p><pre>X_train, X_test, y_train, y_test = train_test_split(X, y, <br>                                                    train_size=0.7, <br>                                                    test_size=0.3, <br>                                                    random_state=42)</pre><h4>Data Ingestion and Predictive Modeling</h4><p>It’s finally time to setup our model.</p><p>We’ll be designing a sequenced-based learning model to extract our vectorized text data which, in this case, involves using a <strong>long short-term memory</strong> model which is simply a higher-order recurrent neural network. This will be used to properly ingest and retain signal comprehension across our data.</p><p>Specifically, we’ll use the following layer specifications:</p><ul><li>An <strong>Embedding</strong> layer to properly vectorize our term inputs for signal extraction.</li><li>A <strong>Spatial Dropout</strong> layer that effectively performs dropout regularization on vectorized text data that prevents overfitting.</li><li>Two <strong>LSTMs</strong> in sequence to extract more internal heuristics. (These models are preinitialized with dropout regularization.)</li><li>A <strong>Dense</strong> (connective-predictive) layer to get our output classification.</li></ul><p>Our model ends up looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rse6kzg6lkVOsqESOpnaaQ.png" /><figcaption>Model summary</figcaption></figure><p>Next, we’ll compile our model with appropriate loss functions, optimizers, and accuracy extraction metrics.</p><p>We’ll be using categorical cross-entropy as our loss function and a boosted form of Adam optimization called Nesterov-Boosted Adam, or Nadam, to get optimal model results. It isn’t that important to understand what categorical cross-entropy or Nesterov-Boosted Adam means, but know that both the loss function and the optimization function are used to calculate and reduce loss, therefore increasing accuracy to our model.</p><pre><em># Compile Model with Specified Loss and Optimization Functions</em><br>model.compile(loss=&quot;categorical_crossentropy&quot;,<br>              optimizer=&quot;nadam&quot;,<br>              metrics=[&quot;accuracy&quot;])</pre><p>We’ll also initialize some final fitness parameters, including our batch size for gradient descent optimization and our total epochs for runtime.</p><pre><em># Define Batch Size and Epochs as Hyperparameters</em><br>batch_size, epochs = 32, 10</pre><p>Now we’re ready to run and evaluate our model!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBb0AEIRY0453B7QHC6xGA.png" /><figcaption>Running our model!</figcaption></figure><h4>Interpreting Results</h4><p>For extra data visualization, we’ll create a <strong>confusion matrix</strong> to show how accurately we performed for our discrete predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*2-17yZO8n2BvsrmeyY-itw.png" /><figcaption>Model’s confusion matrix</figcaption></figure><p>Confusion matrices describe in a visual manner how many data entries were correctly predicted as well as how many data entries were incorrectly predicted during the model’s testing phase. For instance, the confusion matrix to the left tells us that our model could correctly predict 6729 out of 7800 non-political articles and could correctly predict 6371 out of 8086 political articles.</p><p>Our second additional visualization will be that of a <strong>classification report</strong> to clearly display precision, recall, accuracy, and F1 metrics across all labels and for our dataset overall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*yGPfizmU_70ojF337xdXHA.png" /><figcaption>Model’s classification re</figcaption></figure><p>Our report shows that our model had an 82% accuracy rate which means that it performed alright on determining both political and non-political headlines, but not perfectly. Going back to our word cloud, we notice that our performance might have been hindered by some common words that showed up in both politics and non-politics.</p><h3>The Challenges</h3><p>I had noted in the beginning of this article that this project was originally supposed to organize these news headlines into their original classification involving at least 13 different categories (ranging from Entertainment to Sports to World Events, etc.) however there were some complications when dealing with inaccuracies produced by the model.</p><p>For example, my previous attempt resulted in a confusion matrix and classification report such as this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n2cIAK2kJXmCVKKFjQxwdw.png" /><figcaption>Original Model’s confusion matrix</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5bAGWofrxmIiTZHog4Yzw.png" /><figcaption>Original Model’s classification report</figcaption></figure><p>It can be seen that the original model (with an insane looking confusion matrix and an accuracy rating of 37%) was not going to pass as a working news aggregator at all.</p><h3>Future Plans</h3><p>Although this current version of a news aggregator held moderate success, there could be a lot more done to make this project much better. One such suggestion could be to do extra hyper-parameter tuning in order to create a much more accurate, more optimal model (at least 90% accuracy would be excellent). Another future goal is to fix the original intention of this project and create a perfectly accurate news aggregator that can classify over more than two target categories.</p><p>There are literally an infinite number of possibilities to further analyze these sets of data with the power of data science, but for now this serves as a base for Making a News Aggregator using Natural Language Processing(NLP)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b42f6dc7e1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wine Classifier]]></title>
            <link>https://jordanbtansay.medium.com/wine-classifier-7337ad126b3d?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7337ad126b3d</guid>
            <category><![CDATA[random-forest-classifiers]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[decision-tree-classifier]]></category>
            <category><![CDATA[ensemble-learning]]></category>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Wed, 14 Jul 2021 19:27:17 GMT</pubDate>
            <atom:updated>2021-07-14T19:27:17.987Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>An exploration into Ensemble Classifiers</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ghVPVe_D-SXMefktnMWvmA.png" /><figcaption>Wine Classifier’s homepage</figcaption></figure><p>Over the course of a year at Make School, I’ve learned a whole lot about coding, web design, and data science but the most important topic that I’ve gone over the past year wasn’t programming prowess, it was product and business design and building experience. Enter the <a href="https://github.com/RogueNPC/wine-classifier">Wine Classifier</a> which uses a scikit-learn dataset to create a number of classifier models that identify between three different types of wine from the results of a chemical analysis of wines grown in the same region in Italy by three different cultivators.</p><h3><strong>The Motivation</strong></h3><p>Throughout this past month that I’ve been working on this project, I was also going into depth with my concentration (data science) from one of my classes therefore I knew from the beginning I wanted to work on something data science related. From logistic regression, ROC curves, cross-validation, and linear regression to dimensionality reduction and unsupervised learning, I had a lot to choose from, however there was one topic that stood out from the rest: ensemble modeling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*I6nMGOM2IwvJ0luv.jpg" /><figcaption>Example of ensemble modeling. Source: kdnuggets.com</figcaption></figure><p>According to the bibliographic database<em> ScienceDirect</em>, “ensemble modeling is a process where multiple diverse models are created to predict an outcome, either by using many different modeling algorithms or using different training data sets.”¹ The idea of creating an ensemble model using Random Forest models — which in and of itself is an ensemble model made up of a multitude of Decision Tree models — and Support Vector Machine (SVM) models combined using Voting models really piqued my interest while I was learning about them. Out of the model options I could have chosen to create, which included classification (predicting a label) or regression (predicting a quantity), the wine dataset fit classification.</p><h3>The Classification Models</h3><h4>Decision Trees</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1NkTf1tnmV04Hf80bxb5Q.png" /><figcaption>Wine Classifier Decision Tree model</figcaption></figure><p>The first model I explored in the project was the Decision Tree classifier. In short, “A Decision Tree is a simple representation for classifying examples. It is a Supervised Machine Learning where the data is continuously split according to a certain parameter.”² Much like a Binary Tree in general computer science, the Decision Tree also contains nodes, edges/branches, and leaf/terminal nodes. Unlike Binary Trees, however, each of these elements are used in a bit of a different way. General nodes ask questions that test the value of a certain attribute, for example, one of my project’s nodes might ask whether the data values (wines) in the dataset have an alcohol value of 0.557 or less. Edges/branches are organized by the outcome of the test question from general nodes. Referring back to the last example, the data values (wines) that have an alcohol value of 0.557 or less would go one direction while the values that have an alcohol value greater than 0.557 would go the other direction. Leaf nodes predict the outcome of the classifier instead of simply holding a data value, such as class_0, class_1, and class_2. These terminal nodes essentially summarize the conclusions of the Decision Tree model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*UT0f4al-isvvyd73XBLfaA.png" /><figcaption>Wine Classifier Decision Tree model confusion matrix</figcaption></figure><p>To add to the Decision Tree classifier, I also created a confusion matrix to help analyze the performance of the model. Confusion matrices describe in a visual manner how many data entries were correctly predicted as well as how many data entries were incorrectly predicted during the model’s testing phase. For instance, the confusion matrix to the left tells us that our model could correctly predict 14 out of 14 wines in class_0, 12 out of 14 wines in class_1, and 5 out of 8 wines in class_2. At the end of the analysis the final accuracy rating of the model was only 86%.</p><h4>Random Forest</h4><p>Although the accuracy rating was a relatively average 86%, the main reason my first model was a Decision Tree classifier was to compare its performance with the much better Random Forest model. Random Forest models are one of the most used machine learning algorithms for regression or classification analysis by creating a “forest” of Decision Tree models. According to Niklas Donges, a blogger for the ‘Towards Data Science’ publication, “Put simply: random forest builds multiple decision trees and merges them together to get a more accurate and stable prediction.”³ By creating a large sample size of multiple learning models, it increases the overall accuracy of the final model much like how asking for advice from multiple people can end up being more accurate than asking for advice from just one individual.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*9P_YYvSCYNiSEbNxmL0IWQ.png" /><figcaption>Wine Classifier Random Forest model report</figcaption></figure><p>From the Random Forest classifier’s report, we can see that the accuracy of the model was 96%, much higher than the previous, single Decision Tree classifier. The other important numbers to look at from the image include precision and recall. Precision describes the percentage of correct guesses out of total guesses made onto that target class while recall describes the percentage of correct guesses out of total true elements in that target class.</p><h4>Support Vector Machine (SVM)</h4><p>The next model I created, which is generally even more accurate than the Random Forest model, was the Support Vector Machine model. In the SVM algorithm, we plot each data item as a point in n-dimensional space (where n is the number of features you have) with the value of each feature being the value of a particular coordinate. Then, we perform classification by finding the hyper-plane that differentiates the two classes very well.⁴</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Q1ietvPYygPMgirqbxuiKw.gif" /><figcaption>Support Vector Machine algorithm. Source: towardsdatascience.com</figcaption></figure><p>Above is an example of the Support Vector Machine algorithm working on a data set of two classes. It tries to select the hyper-plane that segregates the two classes the best by maximizing the distances between the nearest data point in either class which is called the <strong>margin</strong>. The distances are shown in the example by the double pointed arrows and stops at margin #3 because the distances between the nearest data point in either class are at its maximum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*_qAWjTQxSXWOOrjdn27Wdg.png" /><figcaption>Wine Classifier SVM model report</figcaption></figure><p>Going back to my project, the SVM classifier that I created essentially did the same thing as the example, but with three different classes. The report shows that the model reached an accuracy of an almost perfect 99%, an even better result than the Random Forest model!</p><h4>Voting</h4><p>The last step of the project after creating all of these different models was to combine them all into formulating a hard voting ensemble which involves summing the votes for all the class labels from the other models and predicting the class with the most votes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*R6_8k7PJgZgHbPYwrbrFUg.png" /></figure><p>The voting classifier results shown above explain that the Ensemble model surprisingly performed similarly to the Random Forest model with an accuracy rating of ~96% while the Support Vector Classifier (SVC) model performed the highest with ~99% accuracy. This model only showcases that the voting ensemble is not guaranteed to provide better performance than any single model used in the ensemble and if any given model used in the ensemble performs better than the voting ensemble, then that model, in this case the SVC model, should probably be used instead of the voting ensemble.</p><h3>The Challenges</h3><p>During my time working on this project, I was still in the middle of learning the concepts that I eventually implemented. The fact that the SVC model outperformed the voting ensemble was an unforeseen, but welcome, circumstance and helped me in understanding the nuances of each of these models that I didn’t know about until completing this project and researching more about the situation. There were times that I was feeling a bit lost and unsure of my decision to create this project, but It helped that I had a list of deadlines that I created and stuck to while working on this project in order to guide me back on track at times. Lastly, it was from being pushed and supported by my instructors at Make School that led me to completing this project so although I did all of the work individually, I received a lot of help from them.</p><h3>Future Plans</h3><p>Although this project’s main objective to analyze scikit-learn’s wine dataset with classification models was completed, there are still many more things that I could do to further my understanding such as analyzing a different scikit-learn dataset and going back and applying the other topics I learned over the term that I listed before: logistic regression, ROC curves, linear regression, dimensionality reduction, and unsupervised learning. Even with this project alone, I plan on creating a web application that would make it easier to read the analysis provided by these models or even creating an application that visualizes the insides of these models to further understand how each model works, as it works. There are literally an infinite number of possibilities to further analyze these sets of data with the power of data science… but for now I’ll stick with what I’m learning.</p><p>[1]: Vijay Kotu. (2015). <em>Data Mining Process</em> <a href="https://www.sciencedirect.com/topics/computer-science/ensemble-modeling">https://www.sciencedirect.com/topics/computer-science/ensemble-modeling</a></p><p>[2]: Afroz Chakure. (July 5 2019). <a href="https://medium.com/swlh/decision-tree-classification-de64fc4d5aac">https://medium.com/swlh/decision-tree-classification-de64fc4d5aac</a></p><p>[3]: Niklas Donges. (July 13 2021). <a href="https://builtin.com/data-science/random-forest-algorithm">https://builtin.com/data-science/random-forest-algorithm</a></p><p>[4]: Sunil Ray. (Sept 13 2017). <a href="https://www.analyticsvidhya.com/blog/2017/09/understaing-support-vector-machine-example-code/">https://www.analyticsvidhya.com/blog/2017/09/understaing-support-vector-machine-example-code/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7337ad126b3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Women in Hamilton]]></title>
            <link>https://jordanbtansay.medium.com/women-in-hamilton-dfc9d0d6d298?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfc9d0d6d298</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Thu, 26 Nov 2020 00:46:58 GMT</pubDate>
            <atom:updated>2020-11-26T00:46:58.413Z</atom:updated>
            <content:encoded><![CDATA[<p>Within the musical <em>Hamilton</em>, created by Lin-Manuel Miranda, women play a major role within the overarching plot line, going as far as to affect Alexander Hamilton, the main character, and his legacy. In one instance, the Schuyler sisters are first introduced under their own musical number with the same name involving Angelica, Eliza, and Peggy Schuyler. Within the song, Angelica gets into a conversation with Aaron Burr stating, “We hold these truths to be self-evident that all men are created equal and when I meet Thomas Jefferson, I’m ‘a compel him to include women in the sequel!” These lines portray Angelica as a strong female figure advocating for female empowerment. As the play progresses, Angelica and Eliza become the subject of many more musical numbers — many involving Hamilton as Eliza’s husband.</p><p>In “Say No to This”, Hamilton ends up having an affair with a Miss Maria Reynolds which became one of the first sex scandals in American political history. Although Maria Reynolds never had a grand introduction like the Schuyler sisters, she proved to be an important factor in changing Hamilton’s relationship with everyone around him, ruining his reputation.</p><p>One of the biggest disappointments/jokes that most people shared within the musical, however, was Peggy and her insignificant role within the story. Peggy was so unremarkable that she disappeared midway through the show with no further mention. There was so much discussion of Peggy’s second-act absence on social media that it even inspired a host of hashtags (#andpeggy #justiceforpeggy), memes, and gifs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfc9d0d6d298" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aaron Burr: Hamilton’s Hidden Hero]]></title>
            <link>https://jordanbtansay.medium.com/aaron-burr-hamiltons-hidden-hero-412f7a8b8780?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/412f7a8b8780</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Thu, 05 Nov 2020 06:02:07 GMT</pubDate>
            <atom:updated>2020-11-09T21:26:49.492Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JbS6MXyZEopFEhfj.jpg" /><figcaption>Aaron Burr, played by Leslie Odom Jr.</figcaption></figure><p><em>Hamilton</em>, the award winning broadway musical by Lin-Manuel Miranda, features many extraordinary characters and songs, but one such character and song stands above the rest: Aaron Burr and “Wait for It”.</p><p>Aaron Burr, the typical villain who foils the main hero… except he is anything but one-note. <strong>“I [Burr] am inimitable I am an original”</strong>. Miranda weaves Burr’s story in a way that shows how much the man suffered with lyrics such as “…if there’s a reason I’m still alive when everyone who loves me has died I’m willing to wait for it” and “Life doesn’t discriminate between the sinners and the saints it takes and it takes and it takes and we keep living anyway”. It could have been so easy to demonize Burr for killing Hamilton (who was far from perfect) yet Miranda uses songs like “Wait for It” to showcase Burr was only human and instead told his story in a way to highlight that life isn’t simply split into absolute good and absolute evil, but rather complex. Miranda allowed for people to empathise with Burr despite the fact that he killed the title figure of the musical and the multiple layers within Burr is one of the many reasons why he’s the most intriguing character in the entire musical.</p><p>If compared with the traditional plays in the times of Shakespeare, then <em>Hamilton</em> is a great tragedy. The death of Alexander Hamilton who did so much for his country only to be needlessly killed in a duel with a man whose mind was clouded from misery and misfortune — that is the very definition of a tragedy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=412f7a8b8780" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shakespeare’s Julius Caesar in the Modern Day]]></title>
            <link>https://jordanbtansay.medium.com/shakespeares-julius-caesar-in-the-modern-day-efccd783ffd?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/efccd783ffd</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 04:15:53 GMT</pubDate>
            <atom:updated>2020-10-29T04:15:53.738Z</atom:updated>
            <content:encoded><![CDATA[<h3>“Men at some time are masters of their fates:<br>The fault, dear Brutus, is not in our stars,<br>But in ourselves, that we are underlings.”</h3><p>“I don’t know about this Jim,” Phil said in a soft voice, “I consider myself more of a pacifist.” Phil sat uncomfortably on his desk chair as he darted his eyes back and forth across the room trying to avoid Jim’s stare.</p><p>“Come on Phil, this is important to me and I need my roomie to be there with me, the more the merrier,” Jim insisted as he held his poster board up at Phil. Jim was pushing the sign so close to Phil that he had no choice but to pay attention to it which read ‘Super Callous Facist Racist Sexist Braggadocious’. Phil had felt his temperature rising and begun to shift around in his seat, occupying himself with the thought that braggadocious doesn’t even make sense, when Jim asked again, “So what? Are you gonna come to the protest or what?”</p><p>Phil thought about it for a bit and as he was about to voice his answer when Jim confidently shouted, “Before you answer Phil, just know that men at some time are masters of their fates: the fault, Phil, is not in our destiny, but in ourselves, that we are underlings. This is why I protest.” Phil leaned back on his cushion with all his weight, awestruck by his friend’s enlightening words.</p><p>It was at that moment, Phil whipped back onto his feet, “Ok, let’s go then.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efccd783ffd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing my own Short Story]]></title>
            <link>https://jordanbtansay.medium.com/writing-my-own-short-story-8c71a2e199f4?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c71a2e199f4</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Fri, 16 Oct 2020 03:02:14 GMT</pubDate>
            <atom:updated>2020-10-16T03:02:14.561Z</atom:updated>
            <content:encoded><![CDATA[<p>Although I’ve never thought about writing my own short story, I have told many stories involving events in my life. If I were to write a story, I would probably go for a slice-of-life genre involving fictional characters mirroring the people around me. They would be in a real-world setting either in school or dealing with the hardships of everyday life: something that readers would be able to relate to. The main idea behind every slice-of-life story is to create an exciting scenario that pushes our main characters out of their comfort zone, something that the audience understands could happen to them — no matter how unlikely. As long as the event is thrilling enough to keep their attention, but also realistic enough for the reader to relate to the characters and immerse themselves in the story, the story should be a success. Within stories such as these, there wouldn’t be any grand message or lesson to be learnt, but just a simple retelling of the events carried out by people living their lives and making their own decisions. Just like in real life, these characters could make some bad decisions or make a mistake, however there rarely comes a point where those decisions are life changing or life threatening. There won’t be any magical or science fiction elements added to the story, only a simple documentary of a character’s life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c71a2e199f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Best Stories: A True Story]]></title>
            <link>https://jordanbtansay.medium.com/the-best-stories-a-true-story-ec6a3fb86ec8?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec6a3fb86ec8</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Tue, 29 Sep 2020 23:47:04 GMT</pubDate>
            <atom:updated>2020-09-29T23:47:04.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*xofXMJJEcLyX_ULA.jpg" /><figcaption>Image courtesy of Pixabay</figcaption></figure><p>When I was a child (maybe 5 or 6 years old), I used to always listen to old stories from my parents. Some stories came from books they read during their childhood, others included real stories from how they first met or how they came over to America from the Philippines, there were even a few stories that they heard about from their parents; however, the best stories that I would always remember when I was growing up were ones that sounded so unbelievable, yet were completely true.</p><p>Both of my parents grew up in the Philippines within a large Chinese household. My dad would talk about his large family with his father who had one sister and twelve brothers all living under a large apartment complex. There was even a day when the top floor of the complex caught on fire and it hasn’t been repaired ever since. Meanwhile, my mom told stories about her old middle school days in a religious school where she knew about half of all the students — either being her sibling or her cousin. She would regale stories about her rich aunt who was the branch owner of McDonalds in the Philippines and owned a 15 bed and 15 bath mansion that she and her army of maids lived in.</p><p>The greatest part about every single one of these stories was that they felt so fantastically fake, I couldn’t live with believing them without proof; that is, until my family and I went on a trip to the Philippines a year ago. In my eighteen years of living, I had never been to the Philippines and I was able to see the part of the world where my parents and grandparents and uncles and aunts and cousins — who I never even met or knew the existence of — grew up. We ate at their favorite restaurants and talked to some very accomplished relatives, and even met my father’s brother who I never even heard about, but most importantly, I was able to see that large apartment complex with its completely charred top floor and my mother’s rich aunt’s mansion who gave us a thirty minute house tour complete with a gym room, a movie theater room, and a parking structure-sized garage just to name a few. These fantastical stories became real to me in an instant with a newly found imagination swirling through what it would have been like to be in my parent’s shoes, or anyone’s for that matter.</p><p>I loved these crazy stories that were so hard to believe, but were indeed grounded in reality. I had thought about crafting my own stories based on my own life experiences one day, but I realized that if I could write a short story right in this moment, I would write about a whole collection of short and sweet stories about humanity and our diverse lives and I would have so much source material right next to me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec6a3fb86ec8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hey Jonathan, I can totally relate with your outlook on writing.]]></title>
            <link>https://jordanbtansay.medium.com/hey-jonathan-i-can-totally-relate-with-your-outlook-on-writing-1582223d83b7?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1582223d83b7</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Sun, 27 Sep 2020 22:19:09 GMT</pubDate>
            <atom:updated>2020-09-27T22:19:09.897Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Jonathan, I can totally relate with your outlook on writing. Sometimes it’s hard to write out our feelings and ideas in a direct and succinct way, but expressing ourselves is what makes writing fun and enjoyable. Putting ourselves down on paper is what allows our readers to form strong connections with us as writers. Every so often, I will get distracted from my thoughts and my stream of consciousness will break off but after searching for a new point to grab onto, my thoughts will start to flow onto the page again. Looking at imagery for a way to gain inspiration is a great way to organize and create new thoughts to talk about! Overall, you don’t need to worry about making each line flow into each other, just brainstorm a ton of potential ideas onto the page and delete and merge what doesn’t fit together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1582223d83b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Writing Mentality]]></title>
            <link>https://jordanbtansay.medium.com/my-writing-mentality-6c64c4646a19?source=rss-dbb88fffd96d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c64c4646a19</guid>
            <dc:creator><![CDATA[Jordan Tan-say]]></dc:creator>
            <pubDate>Fri, 18 Sep 2020 06:07:27 GMT</pubDate>
            <atom:updated>2020-09-18T06:07:27.201Z</atom:updated>
            <content:encoded><![CDATA[<p>When writing poetry, I choose to write based off of my personal experiences as well as what pops up from the top of my head. I find it impossible to plan ahead when writing poetry as the theme only flows when the ideas on paper build off of the ideas floating around in my mind.</p><p>Although poetry isn’t easy to create, talking to myself and typing all of my feelings allows me to clear my pessimistic mentality. Only when I get lost in myself and my story does everything become easy. I believe that the challenging part of writing is creating the starting point — even as I write this blog post I spent the most time on the introduction. When analyzing poetry, there is this idea that poetry should hold a deep, convoluted meaning hidden behind the surface level causing some poets to spend hours staring at a blank page striking their ideas down without a second thought and although this is prevalent in many of the popular poems, every poem can be justified in being direct. Instead of second guessing myself, I find it easy to write down the first thing that comes to mind to get over the most challenging part of starting, and then editing over what I missed later.</p><p>In the years before, I never paid attention to my writing process as I never looked back when finished with my works, however now I find that reading through my own complete work as a whole allows me to grasp the intensity of my tone as it seems to always go towards depressing topics. My goals before were to achieve a more productive mentality and improve my editing skills, but nowadays I seem to have trouble creating deep, meaningful poems that holds hidden and enlightening interpretations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c64c4646a19" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>