<?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 Sherry Yang on Medium]]></title>
        <description><![CDATA[Stories by Sherry Yang on Medium]]></description>
        <link>https://medium.com/@sherzyang?source=rss-e86e1bcb017------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*djaQujkXzSC0owz38Opfng.jpeg</url>
            <title>Stories by Sherry Yang on Medium</title>
            <link>https://medium.com/@sherzyang?source=rss-e86e1bcb017------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:48:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sherzyang/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[Making Text Ascent]]></title>
            <link>https://medium.com/data-science/making-text-ascent-1ee428b7a13d?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ee428b7a13d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[wikipedia]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Sun, 03 Nov 2019 00:35:21 GMT</pubDate>
            <atom:updated>2019-11-03T03:40:01.252Z</atom:updated>
            <content:encoded><![CDATA[<h4>How I built and deployed a machine learning web app</h4><p>I’ve often found myself reading an article, say on data science, and wondering, where can I read something simpler on this topic? I realized I wasn’t the only one when a friend posted a similar question on LinkedIn. She asked how to find articles in a specific range between most simple and most complex. I realized we don’t have an easy system for that type of search besides manually reading for a good fit.</p><h4>Business Understanding</h4><p>Building on my interests in web search, I created Text Ascent, a web app that uses unsupervised ML to help users discover content based on text complexity. I hope Text Ascent can be one tool used to address searching for content along all the stages of our learning journeys. Central to the goals I have for Text Ascent is for it to make niche topics of interest between people more accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FJnBTRgJ1EoA-jhz.jpg" /><figcaption>Photo By Ted Bryan Yu from Unsplash</figcaption></figure><h4>Data Understanding</h4><p>I used <a href="https://pypi.org/project/Wikipedia-API/">Wikipedia-API</a>, a python wrapper for <a href="https://www.wikipedia.org/">Wikipedia</a>’s API to gather article titles on topics ranging from art to science. Then I ran a data gathering function (scrape_to_mongodb.py) that took those titles and scraped 11k+ articles for summaries, full text, and urls into a MongoDB database. I excluded articles that had full text less than 300 words because there are entries in Wikipedia like ‘music file’ that did not serve my model’s purpose.<br>See the <a href="https://github.com/sherzyang/text-ascent/blob/master/collect_data.ipynb">Data Collection Notebook</a> &amp; <a href="https://github.com/sherzyang/text-ascent/blob/master/data_exploration.ipynb">Data Exploration Notebook</a>.</p><h4>Data Preparation</h4><p>The content returned from the Wikipedia-API wrapper did not require further cleaning. I did need to make sure that when the content was displayed on the web app that the html was read as JSON to avoid carriage returns displaying to the user. I graded the full text of each document using the <a href="https://pypi.org/project/textstat/">textstat package</a>’s Flesch-Kincaid Grade.</p><p>These files are saved in an AWS S3 bucket to allow make the web app accessible. See the <a href="https://github.com/sherzyang/text-ascent/blob/master/data_preparation.ipynb">Data Preparation Notebook</a>.</p><h4>Modeling</h4><p>The current model uses cosine distance between the top 20 features of importance in corpus vectors and user input vectors to return similar content from the library to user input. The model features were created with TF-IDF vectorizer. TF-IDF vectorizer splits the words in the corpus documents, removes stop words, and computes a term frequency for each word in each document, adjusted for how frequently the word appears in the corpus. In other words, uncommon words are given more weight than commonly used words.</p><h4>Reproduce This Model</h4><ul><li>Get a list of documents of interest and format into a dataframe like clean_df. Get text difficulty scores using TextStat. <em>My example on AWS S3: </em><a href="https://text-ascent.s3-us-west-2.amazonaws.com/clean_df.pkl"><em>clean_df</em></a></li><li>Fit your corpus to your vectorizer (learns vocabulary and idf from training set), which is the text series in your df <em>My example on AWS S3: </em><a href="https://text-ascent.s3-us-west-2.amazonaws.com/vectorizer.pkl"><em>vectorizer</em></a></li><li>Use a vectorizer transform function (transforms documents to document-term matrix) to create your corpus vectors<em>My example on AWS S3: </em><a href="https://text-ascent.s3-us-west-2.amazonaws.com/corpus_vectors.pkl"><em>corpus vectors</em></a></li><li>Clone this repository</li><li>In the traverse_flask directory, create an empty subdirectory named data .</li><li>Implement the flask app by running flask in traverse_flask in the terminal with $ export FLASK_APP=app $ flask run . This flask app.py takes in functions from functions.py. Adjust the functions to change the data pipeline on the backend. Adjust the brython in the static/templates/index.html to change the way data is reflected to the user.</li></ul><p>See the <a href="https://github.com/sherzyang/text-ascent/blob/master/traverse_flask/functions.py">Model Functions</a>.</p><h4>Evaluation</h4><p>This product is successful if users are able to discover content related to what they were already reading that is of a different reading difficulty. User satisfaction, repeat usage, web app traffic, and sharing of the app are the metrics I am using to evaluate Text Ascent’s success. I evaluated 4 models before going with the model deployed on the web app:</p><ul><li>Model 1: Used TextStat, Gensim, and Spacy.</li><li>Model 2: Used Latent Dirichlet Allocation (LDA) topic modeling with 10 topics, then sorts user content into a topic.</li><li>Model 3: Used TextStat and TF-IDF Vectorizer with 2000 dimensions.</li><li>Model 4: Used TextStat and TF-IDF Vectorizer with top 20 features.</li></ul><p>Each iteration was done to so the resulting content was more similar to the user input content.</p><h4>Future Modeling</h4><p>I would also like to compare a pre-trained neural network to my current TFIDF Vectorization to see if the quality of returned content improves. Improvement would be measured through user feedback in a simple manual grading system to be added to the web app. See the <a href="https://github.com/sherzyang/text-ascent/blob/master/evaluation_notebook.ipynb">Evaluation Notebook</a>.</p><h4>Deployment</h4><p>Text Ascent has been deployed as a flask-enabled web app <a href="https://traverse.sherzyang.com/">traverse.sherzyang.com</a> on an EC2 instance (currently not running). The app uses brython to interact between python functions and html. Below are two images from the web app. Given any user input text, the model will output related articles from the library with links in the title to full length articles. Users can scroll or traverse from simpler content to more complex content and the table will update accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*md40BFMhtPnLvWcl.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VrzWh6do2gHVDkz-.png" /></figure><h4>Future Iterations</h4><p>As part of my interests in search and our <a href="https://www.wired.com/story/amazon-alexa-search-for-the-one-perfect-answer/">new world of one-shot answers</a> — thank you Alexa, Siri and Google Home — I plan on deploying Text Ascent as an Amazon Alexa skill. The skill will allow a user to “scroll” or “traverse” along a gradient of simpler to more complex summaries on a topic just like telling Alexa to play a song louder or softer. I believe creating options in content will expand us beyond the world of one-shot answers in a positive way.</p><p>Additionally, I am eager to grow the corpus to include books from Project Guttenberg and beyond. If you have some content you’d like to see added to the current library of wikipedia articles please send me a message on <a href="https://github.com/sherzyang/text-ascent/blob/master/www.linkedin.com/in/sherzyang">LinkedIn</a>. I’ve seen several web extensions that grade a book’s reading difficulty on Amazon or Goodreads (<a href="http://www.arialvetica.com/readup/">Read Up</a> is a great one). Those products inspire me to develop a corpus-free search functionality for Text Ascent in the future. I envision Text Ascent becoming much more useful when it can return Google or Bing web search API enabled content.</p><h4>Credits</h4><ul><li><a href="https://towardsdatascience.com/plotly-express-yourself-98366e35ad0f">Werlindo Mangrobang, Visualization and Web App Deployment</a></li><li><a href="https://github.com/kayschulz/travel_destination_recommendation/blob/master/travel_destination_recommendation/recommend.py">Kayli Leung, Brython</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ee428b7a13d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/making-text-ascent-1ee428b7a13d">Making Text Ascent</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[Ingredients for learning like a human]]></title>
            <link>https://medium.com/@sherzyang/ingredients-for-learning-like-a-human-8ba7a0494a39?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ba7a0494a39</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Mon, 17 Jun 2019 05:08:29 GMT</pubDate>
            <atom:updated>2019-07-07T17:50:57.082Z</atom:updated>
            <content:encoded><![CDATA[<h4>Notes from <a href="https://arxiv.org/pdf/1604.00289.pdf">Building Machines That Learn and Think Like People</a> and <a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a>.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D69Od9jDjB1fQ0nndabv7A.png" /><figcaption>An exhibit from the 2019 Philadelphia International Flower Show.</figcaption></figure><p>Intelligence is more than a theoretical research topic. Look around us and we see our world already consists of shot recommended answers that rely on intelligent reasoning. Recommendations tell us humans what to think about, but we also have to tell machines an awful lot. We feed machines way more data than we ever use ourselves to make decisions. How do we tell them less and have them infer more?</p><p>Earlier this year I read <a href="https://www.wired.com/story/how-to-teach-artificial-intelligence-common-sense/">How To Teach Artificial Intelligence Some Common Sense</a> in <em>Wired</em>. The article discussed the distance that lies between the fully sentient artificial intelligence of our collective imagination or cultural zeitgeist and what’s been created. That distance is all the prior knowledge humans bring to a problem that machines do not have.</p><p>I’d like to explore the building blocks of knowledge mapping and why reverse engineering human intelligence has very practical and immediate business implications. For instance, <em>Wired</em>’s article <a href="https://www.wired.com/story/amazon-alexa-search-for-the-one-perfect-answer/">Amazon Alexa and the Search For One Perfect Answer</a> explores how our reliance on automated answers will completely reshape advertising. The speech recognition systems that are dominating our lives run on neural networks that could benefit from the capabilities of human intelligence.</p><p>In the paper <a href="https://arxiv.org/pdf/1604.00289.pdf">Building Machines That Learn and Think Like People</a>, researchers examine how intuitive physics and intuitive psychology allow humans to approach problems using models rather than pattern detection. The latter is what most of our machine learning models are good at doing, but pattern detection is both inflexible and data hungry. The writers suggest that when AlphaGo surpassed the master Go player in 2016, we should have been more impressed that the master Go player could compete at all. The human had played 50,000 games in his lifetime, while the machine was trained on 100 million. What we are getting at is how to truly capture human learning at the machine level.</p><blockquote>The media has…covered many of the recent achievements of neural networks, often expressing the view that neural networks have achieved this recent success by virtue of their brain-like computation and thus their ability to emulate human learning and human cognition. In this article, we view this excitement as an opportunity to examine what it means for a machine to learn or think like a person.(p.2)</blockquote><p>Essentially, our machines do not yet capture the full extent of human learning by a long shot. Humans are still better at concept learning, scene understanding, creativity, common sense and further reasoning. While this is obvious, breaking down the missing steps are far from inconsequential.</p><p>The paper describes the core ingredients of human intelligence and what builders can do to progress:</p><p>(a) work towards machines that can build models rather than just recognize patterns; and go model-free</p><p>(b) incorporate intuitive physics and intuitive psychology into machines that make their problem solving experiences more human-like</p><p>(c ) apply ability humans have to quickly learn from sparse experiences and generalize knowledge by learning-to-learn “ using previous knowledge to make richer inferences from very small amounts of training data” (p.3) Learning-to-learn is related to transfer learning, which involves taking a model trained on one task and implementing it for another task.</p><p>We are using the existing biological architecture of neuroscience when we say neural network. Neural networks may be primarily used for pattern recognition today. However, the neural networks of tomorrow will look different. “They may be endowed with intuitive physics, theory of mind, causal reasoning, and other capacities”(p.3) The writers also acknowledge that there are plenty of valid developments in AI that do not need the aforementioned concepts to successfully deliver value. Much of the automation in society has not needed to say, understand interpersonal relationships. However, the speed and agility of many machine programs would benefit from human problem solving capabilities.</p><blockquote>There are at least two important differences: people learn from fewer examples and they learn richer representations, a comparison true for both learning handwritten characters as well as learning more general classes of objects (p.9)</blockquote><blockquote>Early in development, humans have a foundational understanding of several core domains (Spelke, 2003; Spelke &amp; Kinzler, 2007). These domains include number (numerical and set operations), space (geometry and navigation), physics (inanimate objects and mechanics) and psychology (agents and groups). (p.15)</blockquote><blockquote>Importantly, unlike in intuitive physics, simulation-based reasoning in intuitive psychology can be nested recursively to understand social interactions — we can think about agents thinking about other agents. (p. 20)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TcH3jY2kjJ2VTnUYgBKwFA.png" /><figcaption><a href="https://arxiv.org/pdf/1604.00289.pdf">Building Machines That Learn and Think Like People</a></figcaption></figure><p><em>Speed</em><br>The speed of learning comes in part by prior knowledge, which the writers break down into intuitive physics and intuitive psychology; and in part by the small amount of data that humans need to solve a problem. We can also build solutions in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OC3YVWebgTENpNlZZ1StKw.png" /><figcaption><a href="https://arxiv.org/pdf/1604.00289.pdf">Building Machines That Learn and Think Like People</a></figcaption></figure><p><em>Flexibility</em><br>While machines can learn the game frostbite, adding new sub-goals can make the machine confused in ways that humans would not be. To humans, sparsely observed data can have rich meaning while it presents hurdles for machines.</p><p><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">Common Sense</a> lives under the umbrella of intelligence and explored in the paper by University of Seattle and Allen Institute for AI. The team works on knowledge graphs of social situations, mental states, and casual relationships. In the future perhaps we can think of this: Can machines help us express what we cannot even communicate? I’d like a model that can take what is misinterpreted and make it clear when we cannot. ATOMIC is a “machine learning atlas of human commonsense” that is a start to thinking about inferential knowledge that is essential for automated commonsense reasoning. ATOMIC is has a different approach than the taxonomic or encyclopedic ways that came before it and can scale. Below are descriptions of how ATOMIC was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDS_FdpwhWuLxPobS4F-iw.png" /><figcaption><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Agp5AWh7S3Q2uDyEVM1MsA.png" /><figcaption><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*AFTJ1AEq1OJ7Oo0PEn-Z1A.png" /><figcaption><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*YClSP4Wo0-1hCvJxIzY5pQ.png" /><figcaption><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a></figcaption></figure><p>The question is, can the model take an unseen event and make an if-then-inference? “Given the event phase <em>e</em> and inference dimension <em>c</em> the model generates the target t = f(e,c)”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjftrB1g8ruS5NgxXW7lmA.png" /><figcaption><a href="https://mosaic.allenai.org/projects/commonsense-knowledge-graphs#paper">ATOMIC: An Atlas of Machine Commonsense for If-Then Reasoning</a></figcaption></figure><p>Perhaps with this inferential knowledge graph; <a href="https://hbr.org/2019/01/the-future-of-ai-will-be-about-less-data-not-more">the future of AI will be less data, not more</a> like described in this Harvard Business Article. With work on general intelligence, more edge cases can be taken on, companies with less data can compete, and problems can be solved in this lifetime.</p><p>Case #1 from HBS</p><blockquote>Using bottom-up machine learning methods, the gas turbine would have to run for a century before producing enough data to begin training. Instead, <a href="https://www.siemens.com/innovation/en/home/pictures-of-the-future/digitalization-and-software/artificial-intelligence-ai-in-gas-turbines.html">Siemens researchers</a> Volar Sterzing and Steffen Udluft used methods that required little data in the learning phase for the machines. The monitoring system that resulted makes fine adjustments that optimize how the turbines run in terms of emissions and wear, continuously seeking the best solution in real time, much like an expert knowledgeably twirling multiple knobs in concert.</blockquote><p>Neural networks are not the only models we can use.</p><p>Case #2 from HBS</p><blockquote>Probabilistic models that can deal with extensive uncertainty, act on sparse data, and learn from experience. Alphabet, Google’s parent company, launched <a href="https://www.wired.com/2017/02/machine-learning-drifting-real-world-internet-balloons/">Project Loon</a>, designed to provide internet service to underserved regions of the world through a system of giant balloons hovering in the stratosphere. Their navigational systems employ Gaussian processes to predict where in the stratified and highly variable winds aloft the balloons need to go. Each balloon then moves into a layer of wind blowing in the right direction, arranging themselves to form one large communication network. The balloons can not only make reasonably accurate predictions by analyzing past flight data but also analyze data during a flight and adjust their predictions accordingly.</blockquote><p>In a world where database management systems and data sources themselves rule the roost and call the shots, the implications of an inferential world are massive. It all starts with a few human ingredients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ba7a0494a39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting set up in PostgresSQL]]></title>
            <link>https://medium.com/data-science/getting-set-up-in-postgressql-e29db4e6d7fc?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/e29db4e6d7fc</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Wed, 05 Jun 2019 03:09:52 GMT</pubDate>
            <atom:updated>2021-06-17T00:09:53.137Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using PSQL and Python Pandas together</h4><p>One of the big challenges I faced after taking introductory tutorials in writing structured query language (SQL) queries was how to practically use these queries. Tutorials give us a nice environment to start out in but don’t always provide an accessible bridge to working on our own. Here’s a quick walk through of SQL, and a tutorial for querying using the PSQL server.</p><p>First we need to understand why we need databases. While learning as students, we often work with relatively small data sets that can be saved on our own machines. However, in practice we need the ability to store and retrieve data that is too large for an individual machine’s memory. The need for databases originated as a result of what was considered big data at the time.</p><p>Databases store information systematically to allow for storage, manipulation and management. There are four main types of database management systems (DBMS): hierarchical, network, relational, and object-orientated relational DBMS. SQL is used to deal with relational database management systems or servers.</p><p>These servers go by names such as SQL Server, MySQL, SQLite, and PostgreSQL, which can make the use of the word SQL as both a reference to the language and to the relational database confusing. “Several database platforms use SQL, but a slight variation on it — each tend to have a slightly different syntax.” (<a href="https://www.upwork.com/hiring/data/sql-vs-mysql-which-relational-database-is-right-for-you/">Source</a>) We can also use a syntactic evolution of SQL language called SQL Alchemy inside a SQL server.</p><p>We have both open source and licensed servers available to us. Here’s a brief look at a few types of database management systems: <a href="https://www.upwork.com/hiring/data/sql-vs-mysql-which-relational-database-is-right-for-you/">Microsoft SQL Server vs. MySQL</a>, <a href="https://blog.panoply.io/postgresql-vs.-mysql">PostgreSQL vs MYSQL</a> and <a href="https://blog.panoply.io/postgresql-vs-mongodb">PostgreSQL vs MongoDB</a> for instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4Qw8g9F1f1EkPfv1IWuFA.png" /></figure><p>PSQL is a good choice because it’s been in development for more than 30 years, is ACID-compliant — which stands for Atomicity, Consistency, Isolation, Durability and means loosely protection against errors, and it has become the open-source relational database for many organizations. It is used to build applications and trusted to protect data integrity (<a href="https://www.postgresql.org/about/">Source</a>).</p><p>To get started, we’ll work with the csv files from the Kaggle dataset <a href="https://www.kaggle.com/usernam3/shopify-app-store">Shopify App Store</a>. In the workplace we would likely not start with a csv file of data because on principle, we are trying to work with data that is too large to be saved in a mere csv file. However, because we are learning, we will use a small set of data that doesn’t require a server to view, but can be queried for practice.</p><p>We’ll take a look at the pricing data for Shopify’s app marketplace. Shopify, a Canadian e-commerce site, competes against Amazon for sellers. It “powers over 600,000 businesses and have sold over $82bn” through their platform. In some cases, <a href="https://www.websitebuilderexpert.com/ecommerce-website-builders/comparisons/shopify-vs-amazon/">Shopify beats out Amazon as the choice e-commerce platform on the market</a>.</p><p>We can see there are five tables in this dataset — apps, categories, plan_features, pricing_plans, reviews. We will first create an Entity Relationship Diagram (ERD) to understand the relationship between columns of data in the tables. That will allow us to:</p><blockquote>Determine foreign and primary keys</blockquote><blockquote>Determine data type of each column — a good rule of thumb is only columns with data that we intend to do mathematical calculations on should have the type integer.</blockquote><blockquote>Understand types of relationships between tables: one-to-many, many-to-one etc.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qcoY6WF4yCOgGvlMYkiHzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*_AKfYl-g7rGylNWI8AJj3g.png" /><figcaption>Source (<a href="https://www.lucidchart.com/pages/ER-diagram-symbols-and-meaning">https://www.lucidchart.com/pages/ER-diagram-symbols-and-meaning</a>)</figcaption></figure><p>I set my primary keys because they are the parent records. The foreign keys contain child records. (<a href="https://stackoverflow.com/questions/1429407/determining-the-primary-and-foreign-table-in-a-relationship">Source</a>) This can be really tricky to figure out the more tables we have. We know that a table can “only have one primary key” and that it’s “good practice to add a primary key to every table”. <a href="http://www.sqltutorial.org/sql-primary-key/">“Primary keys do not accept NULL or duplicate values.”</a> We may need to create a primary key that consists of two or more columns which is known as the composite primary key. That is explored further <a href="http://www.postgresqltutorial.com/postgresql-primary-key/">here</a>.</p><p>In order to get our data out of the csv files, we’ll start out in the command line of bash. We can get into our PSQL server in our command line and create a database. Then we can navigate to our database with <strong>\connect</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*M8viUo9eq9W-NGlRrZshfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*uwf-CcItlVxo87E3lGnInA.png" /></figure><p>We then create a file in our text editor and save it as a SQL file. I am choosing to use the text editor from Jupyter Notebook, but we could also use Visual Studio Code. In this case, I will call my file create_tables.sql. Below is the code I wrote in my text editor for the apps table.</p><pre>/* Drop the apps table if it exists */<br>DROP TABLE IF EXISTS apps;</pre><pre>/* Create skeleton table that supplies the table name, column names, and column types */<br>#set up our SQL tables</pre><pre>CREATE TABLE apps(<br>  url text PRIMARY KEY<br>, title text<br>, developer text<br>, developer_link text<br>, icon text<br>, rating text<br>, reviews_count integer<br>, description text<br>, description_raw text<br>, short_description text<br>, short_description_raw text<br>, key_benefits_raw text<br>, key_benefits text<br>, pricing_raw text<br>, pricing text<br>, pricing_hint text<br>;</pre><pre>/* Copy data from CSV file to the table */<br>COPY apps <br>FROM &#39;/Users/sherzyang/flatiron/mod_3/week_7/my_practice/shopify-app-store/apps.csv&#39; <br>WITH (FORMAT csv);</pre><p>Now I will head back into bash and try to create my first table within my database. I came up with the error “unquoted carriage return” which I learned is an error with the csv file, not typically with a command from our end gone array. I learned that this was due to \n appearing in my data. This <a href="http://utf-8.icebolt.info/">likely could have happened </a>because the data was downloaded in a windows program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*WTQEyqXHSV8WvKwdx6H-LA.png" /></figure><p>I used this fix on the file and nice, it worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*eSIE9rr4ZzyrEG_YgqMRSw.png" /><figcaption>Source (<a href="http://bit.ly/2JsArGY">http://bit.ly/2JsArGY</a>)</figcaption></figure><p>I was able to move the other csv files into tables by editing my text code and calling the file in bash in PSQL with <strong>\i create_tables.sql</strong>. For other commands, I used this <a href="https://www.dataquest.io/blog/sql-intermediate/">great tutorial on intermediate PSQL</a>. I used the following code for my other tables:</p><pre>CREATE TABLE plan_features(<br>  pricing_plan_id text <br>, app_url text <br>, feature text<br>;</pre><pre>CREATE TABLE categories(<br>  app_url text <br>, category text <br>;</pre><pre>CREATE TABLE reviews(<br>  app_url text <br>, url text <br>, author text<br>, body text<br>, rating text<br>, helpful_count text<br>, posted_at text<br>;</pre><pre>CREATE TABLE pricing_plans(<br>  id text PRIMARY KEY <br>, app_url text <br>, title text<br>, price text<br>, hint text<br>;</pre><p>Once I have my data in tables in PSQL, I can move to my Jupyter notebook and connect to my sqlalchemy engine.</p><pre>import psycopg2<br>import numpy as np <br>import pandas as pd<br>from sqlalchemy import create_engine</pre><pre>#connect to the database and make a cursor<br>conn = psycopg2.connect(&quot;dbname=shopifydb_1&quot;)<br>cur = conn.cursor()</pre><pre>#loop through our queries list and execute them</pre><pre>for query in queries_list:<br>    cur.execute(query)<br>    conn.commit()</pre><pre>#set up a sqlalchemy engine</pre><pre>engine = create_engine(&quot;postgresql:///shopifydb_1&quot;, echo=True)</pre><p>Now I can query through my tables. What I want to see is reviews and the apps they belong to together in one DataFrame. What’s interesting about connecting these tables is the awareness that we have a one to many join between one app and many reviews for that one app. Through this query we can also practice creating aliases, which gives us nicknames for the full names of tables and casting, which turns a column type from one to another.</p><pre>q = &quot;&quot;&quot;<br>SELECT <br>  r.rating<br>, r.body<br>, r.helpful_count<br>, p_p.price<br>, a.rating<br>, a.reviews_count<br>, a.key_benefits<br>, a.pricing<br>, a.url<br>, a.title</pre><pre>FROM apps AS a<br>JOIN pricing_plans p_p<br>    ON cast(a.url as text) = cast(p_p.app_url as text)<br>    AND a.title = p_p.title<br>    <br>JOIN reviews r<br>    ON a.url = r.app_url<br>&quot;&quot;&quot;</pre><p>We can query through a very large database using SQL to isolate the data we need. If you make a mistake and introduce an error, you can always use the following code to rollback the cursor as long as you have not committed the previous action.</p><pre>conn.rollback()</pre><p>Now we can run the query and read the results as a pandas DataFrame. We would want to do this to perform statistical tests, transformations, visualizations and more on the slice of data that we are examining. (For calculations on larger amounts of data, we will need to use say, <a href="https://spark.apache.org/examples.html">Apache Spark</a> instead of inserting the data into a pandas DataFrame.)</p><pre>#read our query as a DataFrame<br>df_join = pd.read_sql_query(q,con=engine)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qxv-E2vx7HoC0FUZd9X34A.png" /></figure><p>Finally we can save our query back into a csv file if needed.</p><pre>#save our selected query back into a CSV file<br>df_join.to_csv(&#39;data.csv&#39;)</pre><p>This was a quick look at how to use psql and its relationship to SQL and python’s pandas library. Hope it’s useful, and helps you play I Spy (figuratively) with your data a little easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e29db4e6d7fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/getting-set-up-in-postgressql-e29db4e6d7fc">Getting set up in PostgresSQL</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[Challenges in sentiment analysis: a case for word clouds (for now)]]></title>
            <link>https://medium.com/data-science/challenges-in-sentiment-analysis-a-case-for-word-clouds-for-now-6e598def5794?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e598def5794</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Mon, 13 May 2019 20:00:01 GMT</pubDate>
            <atom:updated>2019-06-07T20:37:52.556Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring simple python code visualizations for marketing</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FiUaHtkDPYX3Mc%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdomhnall-gleeson-ex-machina-alex-garland-iUaHtkDPYX3Mc&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FiUaHtkDPYX3Mc%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="202" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d26435e8dc687ab674dc0bb27c542b2/href">https://medium.com/media/9d26435e8dc687ab674dc0bb27c542b2/href</a></iframe><p>When I think about artificial intelligence, I get into this tricky habit of mixing understanding with capability. I imagine that there are ways we can tell how much a machine knows by what it can produce. However, the interesting thing to me is that machines don’t actually need to understand anything to produce a lot computationally. Popular science blurs this idea with a lot of conversation around things like the turing test. Movies like <em>Ex Machina</em> and <em>Bladerunner</em> give us a sense that perhaps there is some understanding that machines can take on about the world around them. These ideas in our zeitgeist blur into how we perceive tool capability used in industry today. Through some tertiary data science exploration, I will try and unpack one challenge commonly still faced in marketing today — summarizing content without reading all the content.</p><p><strong>Walking through a marketing challenge.</strong></p><p>When we are in a meeting, we can listen and summarize the main points of the content we are consuming. However, say we needed to summarize 400 documents — there must be a better way than <em>reading</em> all the documents. Social listening is used in marketing as a means to synthesize large amounts of content about brands, but the common ways of summarizing information still leave much to be desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B3THdFR60RK8gTjCPp9BWg.png" /><figcaption>A low-cost social listening dashboard that can be used by marketers.</figcaption></figure><p>We have long understood that twitter could be used to aggregate understanding about what humans talk about. In many ways, we can get unparalleled insights on things like brand perception, trending words, positive or negative attitudes and a variety of feelings based summaries. In my last job, I worked with a social media listening dashboard. I was able to query topics and get a ‘scraper’ in a sense to gather written content from across the web. I didn’t know it at the time, but this was my first foray into the challenges behind unstructured ‘big data’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xtHQZsskCBR_nEkc1AsyhA.png" /><figcaption>How can I get the summaries of these mentions without reading through each tweet myself? What if all the mentions are not in english? (Source: <a href="http://bit.ly/2LIErFq">http://bit.ly/2LIErFq</a>)</figcaption></figure><p>While I was able to gather thoughts from the ‘wild’, summarizing these thoughts into meaning had more nuances that I anticipated. I wanted to produce a condensed version of the ideas that people were writing at a higher level than what a word cloud could provide. Today social listening platforms can help us understand whether content is positive or negative, and what emotion the content might express. However, I still have to read the content to connect the idea expressed to the labeled emotion.</p><p>It is through learning data science skills that I see how we can and cannot address these problems with basic code. The data science tools I have now can deal with the noise in data, but cannot quite read and summarize for me. I was certain for a long time that there were better ways to summarize content than through word clouds. However, after much searching, I have come to accept that word clouds are pretty good — for now.</p><p><strong>Gathering my own tweets.</strong></p><p>I used the tutorial provided by <a href="https://towardsdatascience.com/selenium-tweepy-to-scrap-tweets-from-tweeter-and-analysing-sentiments-1804db3478ac">Scraping Tweets And Analyzing Social Sentiment </a>to look at why the word cloud ultimately works even though it feels overrated, and why something better is hard to find. I will be using scraped tweets about the recent Uber IPO as an example set of data. My question is, how can I visualize a summary of the conversations around the Uber IPO that took place a few days ago?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LhTCsctrlf8L0118zOVP5A.png" /><figcaption>A piece on NPR. (Source: <a href="https://n.pr/2YuWIrk">https://n.pr/2YuWIrk</a>)</figcaption></figure><pre>At this point, follow the code provided by: <a href="https://towardsdatascience.com/@amardeepchauhan">Amardeep Chauhan</a> in his post <a href="https://towardsdatascience.com/selenium-tweepy-to-scrap-tweets-from-tweeter-and-analysing-sentiments-1804db3478ac">Scraping Tweets And Analyzing Social Sentiment</a>. </pre><p>I collected the tweets, cleaned the text, tokenized their sentiment, and then split the tweets into two sentiment groups, positive and negative. Given the choice between using Tweepy and Selenium, I decided to use Tweepy to collect 1057 tweets. Selenium is the tool I was more familiar with, but my pointer was never able to land at the starting point of my scrape without logging into Twitter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPgHUZRWLXL7exZ5UslnBA.png" /></figure><p>This was as much a lesson in following tutorials as it was in visualization. There seemed to be two lines of code that are needed to get the sentiments into a “column” or series in the dataframe that was not in the tutorial I was using:</p><pre>def fetch_sentiment_using_textblob(text):<br>    sentiment = []<br>    for i in text: <br>        analysis = TextBlob(i)<br>        # set sentiment <br>        if analysis.sentiment.polarity &gt;= 0:<br>            sentiment.append(&#39;positive&#39;)<br>        else: <br>            sentiment.append(&#39;negative&#39;)<br>    return sentiment</pre><pre>Code above by: <a href="https://towardsdatascience.com/@amardeepchauhan">Amardeep Chauhan</a></pre><pre><strong>tweet_list = tweets_df[&#39;absolute_tidy_tweets&#39;].tolist()</strong></pre><pre><strong>tweets_df[&#39;sentiment&#39;]= fetch_sentiment_using_textblob(tweet_list)</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVsDAI-vjW_zY77Ymxbu7Q.png" /></figure><p><strong>Asking whether my classification tool works.</strong></p><p>At this stage, I stop and think, does my algorithm used to separate sentiments work? For example, if I only take the list of positive tweets and I get an aggregate sentiment score for the positive group using a different classification method, I am shown that within the group of positive tweets are some negative sentiments.</p><p>{‘positive’: 108, ‘neutral’: 189, ‘negative’: 89}</p><pre>sid = SentimentIntensityAnalyzer()<br>sentiment_summary = dict()<br># for readme in readmes:<br>#     sentences = nltk.tokenize.sent_tokenize(readme)<br>#     for sentence in sentences:<br>#         sentiment_score = sid.polarity_scores(sentence)</pre><pre>messages = pos_list<br>summary = {&quot;positive&quot;:0,&quot;neutral&quot;:0,&quot;negative&quot;:0}<br>for x in messages: <br>    ss = sid.polarity_scores(x)<br>    if ss[&quot;compound&quot;] == 0.0: <br>        summary[&quot;neutral&quot;] +=1<br>    elif ss[&quot;compound&quot;] &gt; 0.0:<br>        summary[&quot;positive&quot;] +=1<br>    else:<br>        summary[&quot;negative&quot;] +=1<br>print(summary)</pre><pre>Code above by: <a href="https://itnext.io/@tbarrasso">Thomas Barrasso</a></pre><p>I can also compare algorithms that give me positive and negative categorization. In this case I looked at: A. Bag of words (Simple vectorization), B. TF-IDF (Term Frequency — Inverse Document Frequency). Bag of words (Simple vectorization) produces an F1 score of 0.7745 while TF-IDF produces an F1 score of 0.79227. Not too different! For more on what the F1 score means, check out <a href="https://towardsdatascience.com/accuracy-precision-recall-or-f1-331fb37c5cb9">this post</a> by <a href="https://towardsdatascience.com/@koolanalytics">Koo Ping Shung</a>.</p><pre>from sklearn.naive_bayes import GaussianNB<br>from sklearn.model_selection import train_test_split<br>from sklearn.metrics import f1_score<br>def naive_model(X_train, X_test, y_train, y_test):<br>    naive_classifier = GaussianNB()<br>    naive_classifier.fit(X_train.toarray(), y_train)</pre><pre># predictions over test set<br>    predictions = naive_classifier.predict(X_test.toarray())<br>    <br>    # calculating f1 score<br>    print(f&#39;F1 Score - {f1_score(y_test, predictions)}&#39;)</pre><pre>X_train, X_test, y_train, y_test = train_test_split(bow_word_feature, target_variable, test_size=0.3, random_state=870)<br>naive_model(X_train, X_test, y_train, y_test)</pre><pre>X_train, X_test, y_train, y_test = train_test_split(tfidf_word_feature, target_variable, test_size=0.3, random_state=870)<br>naive_model(X_train, X_test, y_train, y_test)</pre><pre>Code above by <a href="https://towardsdatascience.com/@amardeepchauhan">Amardeep Chauhan</a></pre><p><strong>Sharing findings.</strong></p><p>So now I ask how I can share some of these thoughts with a non-technical audience. I took a look at the top used words with bar charts.</p><pre>import matplotlib<br>import matplotlib.pyplot as plt<br>%matplotlib inline</pre><pre>x = list(dict(top_15_pos).keys())</pre><pre>y = list(dict(top_15_pos).values())</pre><pre>plt.barh(x,y, align=&#39;center&#39;, alpha=0.5)<br>plt.xlabel(&#39;Mentions&#39;)<br>plt.title(&#39;Top 15 words used in positive Uber IPO tweets&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akE8iAvp5cLpmFcfK1JvyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*THQYU7AC567vFrXFF3h-zA.png" /></figure><p>Well what about something more sophisticated? There were a lot of options with the seaborn library, and I iterated through many that I thought might be more intuitive than a word cloud. However, my conclusion is that though there are plenty of “sophisticated looking” visualizations, most of them were not better than a bar chart or word cloud for sharing content meaning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ZyxZ8Qv_bY0viu3ZmQBnw.png" /><figcaption>Different visualizations that the seaborn library can help produce.</figcaption></figure><p>None of these charts actually produced any further insights. I asked the writer of the sentiment analysis tutorial I was using for the types of visualizations he would use. Here is his response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vx-kNl72O5gCGXWXzrUNQ.png" /></figure><p>Ultimately, I used this <a href="https://pythonspot.com/matplotlib-bar-chart/">tutorial</a> with the below code to create two word clouds of the terms associated with positive and those associated negative sentiment.</p><pre>all_words = &#39; &#39;.join([text for text in pos_df[&#39;absolute_tidy_tweets&#39;]])<br>from wordcloud import WordCloud<br>wordcloud = WordCloud(width=800, height=500, random_state=21, max_font_size=110).generate(all_words)</pre><pre>plt.figure(figsize=(10, 7))<br>plt.imshow(wordcloud, interpolation=&quot;bilinear&quot;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vE_GQfQerhN-qCgULYsNMA.png" /><figcaption>The words that occurred with a positive value for the text.</figcaption></figure><p>What is useful about the word cloud is that it does start to get into the scale of some terms over others. I can also use the word cloud to show how using an algorithm can be useful. There are common words on both the negative and positive visualizations, showing that the same phrases can mean different things in new contexts, and that algorithms can consume information from an entire phrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0GZmTariro2jaKNvoyOXg.png" /><figcaption>Words that occurred with the negative labeling of text.</figcaption></figure><p>But say I don’t need to just know if some news is perceived positively or not, I need to get to some sense of what it all means. I can’t get a summary of all the ideas in longer phrases, like the notes that you’d get from minutes at a meeting with word clouds. I lose the context of the entire sentence these phrases were in, and can only bring my own interpretation and outside research into these word cluster.</p><p>In the end, it may be more useful to read something like this <em>New York Times </em>piece to get a true understanding of what we mean when we say what we say. However, I do want to close with the idea that through deep learning <em>we are able</em> to <a href="https://towardsdatascience.com/text-summarization-using-deep-learning-6e379ed2e89c">summarize whole ideas</a> and not just word statistics. A friend of mine took a super deep dive into<a href="https://medium.com/@hussein.sajid7/deep-learning-for-sentiment-analysis-7da8006bf6c1"> deep learning for sentiment analysis</a> that I would highly recommend reading. The challenge is many mainstream tools do not yet offer these capabilities, and word clouds are not that <em>bad</em> of a choice all things considered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AyjHzBx_PAmR_c9RGlX54w.png" /><figcaption>A piece from the New York Times. (Source: <a href="https://nyti.ms/2W1w63j">https://nyti.ms/2W1w63j</a>)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e598def5794" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/challenges-in-sentiment-analysis-a-case-for-word-clouds-for-now-6e598def5794">Challenges in sentiment analysis: a case for word clouds (for now)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The human inside our machine]]></title>
            <link>https://medium.com/@sherzyang/the-human-inside-our-machine-17c61d678c22?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c61d678c22</guid>
            <category><![CDATA[science-fiction]]></category>
            <category><![CDATA[humanity]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Thu, 25 Apr 2019 06:36:04 GMT</pubDate>
            <atom:updated>2019-05-01T19:21:03.099Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why I’m Studying Data Science</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GBFbOCD6N0x1ZDg_E-KdMw.png" /><figcaption>Outside my dad’s childhood home in Ningdu, Jiangxi Province, China in 2015.</figcaption></figure><h4>Change.</h4><p>My cousin strikes the match and it sets off the hiss of the firecracker. BOOM, CRACKLE, SPAK, POW! The air fills with the haze of smoke like the air fills with dust as we roll away. In the driver’s seat, my uncle tells me that in Ningdu city center, it was like 200 years had passed in the span of less than 50. What you saw in the village, compare that to what you see in the city. That’s how much progress has taken place, he says. We pick up speed in the car, and the rice fields blend together into the afternoon. The sky is overcast and I can almost taste the precipitation about to fall. The cicadas outside buzz to say, we’re hot and we like it! I think, wow I was at home. I was at a home that had a history of my family from before I existed as family.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6JI7cO5AzxShUHQMChU5A.jpeg" /><figcaption>A rice field near my dad’s childhood home.</figcaption></figure><p>My dad grew up in Ningdu, in Jiangxi, a rural province in southeastern China that serves as a major source of agriculture for the country. Here in the 1930’s Mao Zedong organized his first peasant government, developed guerrilla war tactics in the mountains, and eventually went on to force Chaing Kai-Shek to what is now Tiawan. Decades later, he sent the entire nation into the communist revolution. Publicly the people were building a utopia. Privately they were starving and being silenced. Depending on who you’re talking to, you can’t really say that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bb9G0t_kQLjNT1bq90wqnw.jpeg" /><figcaption>A view of Ningdu and its surrounding fields from the mountainside.</figcaption></figure><p>On this day, I’m in the car with my uncle, riding away from my dad’s childhood home. We pass by all these rice fields and orange groves and lotus blossoms. We travel over a long bridge covering a wide, shallow river. My uncle says when he was growing up, they would take the sampan to cross because there was no bridge. I close my eyes and see the village houses with their dirt walls and wood burning stoves being demolished to make way for new buildings. Always a supporter of progress, I cringe at my next thought. I want to preserve it all. I never wanted that home I saw to change.</p><p>There’s very little on Wikipedia about Ningdu. My short time there in 2015 gave me the idea to write about the city and its people. My conversation with my uncle made me want to capture the change that had taken place — all ‘200-years-in-50’ of it. Since talking to him I’ve always wanted to tell a data-driven story, to model not just the economic changes of the past but one that understands the people in Ningdu and the city’s future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vI6Pmnn5qq_x49x3yS7unQ.jpeg" /><figcaption>Ningdu city center from a hotel window in 2015.</figcaption></figure><h4>Home.</h4><p>The funny thing about home is that we each have to grapple with a home of fondest memory, idealization, or dream. This image is often fixed in our mind throughout our life. We have to allow it to coexist with the ever changing places we call home. In Spike Lee’s BlacKkKlansman, we see the fight for home not a thing of the past but the foundation of our present lives. As the first black investigator of the Colorado Springs Police Department, Ron Stallworth dares to go undercover in the 1970’s to expose criminal activity within the Ku Klux Klan. He has a vision of what home should be, and it is not what he sees. The current political landscape in the United States is like silly putty, pulled apart to the last strands, for this very reason.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F2rANGs5dxQuydGfyDs%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fblackkklansman-focus-features-blackkklansman-movie-2rANGs5dxQuydGfyDs&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F2rANGs5dxQuydGfyDs%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="177" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed0c86045ad35259e882815b7fa30006/href">https://medium.com/media/ed0c86045ad35259e882815b7fa30006/href</a></iframe><p>The world changes, and humans react. <a href="https://www.nytimes.com/2018/05/22/upshot/rural-and-urban-residents-feel-disparaged-pew-survey.html">Rural areas pull apart from urban centers, new technology grows a labor force divide</a> as much as it creates new markets. Some of us try to anticipate this change, others try to prevent it. The thing is, home has to change. When we try and preserve a time period to do with what we want, we fail.</p><p>To cope we do many things. One way is through creating science fiction. The stories leave us wondering if it will be long before our imagined world becomes our real one. The sci-fi movie <em>Transcendence</em> asks, would you want to let your neural network survive knowing it would evolve into something different than you are today? My dear friend <a href="https://player.fm/series/mind-machine-future-tech-futurist-ideas-futurism/26-neuromorphic-computing-ai-chips-emulating-the-brain-with-kelsey-scharnhorst">Kelsey, who is growing artificial neurons</a>, says we are a long way from downloading our brain. So maybe we don’t have to decide just yet. However, the decisions we make will matter and the free market may not be the only guardrail we need.</p><p>There is a darkness that science fiction often trends towards because there is real possible danger in new technology. Our stories capture fear quite well. We talk about the difference between humans and machines decreasing every day. However, I think our business world needs the understanding of what exactly fills that distance between human and machine. We need people who can see the divide between humans and the AI we imagine not with the lens of absolute fear or with that of unwavering glee, but with empathy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl2SqblV4jfjdExmr6%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fwestworldhbo-hbo-westworld-l2SqblV4jfjdExmr6&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl2SqblV4jfjdExmr6%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/47c5e4d3eb0fe7751efc20799080b70a/href">https://medium.com/media/47c5e4d3eb0fe7751efc20799080b70a/href</a></iframe><h4>The human inside the machine.</h4><p>This time last year I was finishing up a project on the new clinical research competitive landscape. I was looking for a way to talk about connections between data using skills beyond excel and well, reading. I started to teach myself SQL and dig into what data science meant. To me, studying data science gives you access to a tool set that can be applied to understanding change in real time.</p><p>These days I’m studying data science at the Flatiron School in Seattle. I want to build products that enable more people to discover information in a way that enriches their lives. A core concept I am passionate about is connecting people with well-being and access to resources. I like making people feel heard and included. I am interested in the narrative we tell ourselves about who we are, the way we interact with our environment, and in human development.</p><p>I’m also studying data science because I don’t want to fear my vulnerabilities so much. In this pursuit, I have to ask myself every day what I do not know, but must not define my world by what I cannot do. I must always be molting, always learning, always a beginner. The more I know, the less I know.</p><p>Every day we’ll know less relative to the exponentially increasing amount of information out there. While that matters for us, it matters way less for machines. <a href="https://onezero.medium.com/machine-learning-might-render-the-human-quest-for-knowledge-pointless-5425f8b00a45">Our machines can give us understanding about the universe without having to understand anything themselves at all.</a> However, there is still a human needed inside our machines to ask <em>why</em>. When I walk into a room of people I think about how to create commonality, and how to make everyone feel like they are an individual. The machine doesn’t know why that would be important yet.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o85xlPpHMtxW6u2gE%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffilmlinc-ridley-scott-the-martian-new-york-film-festival-3o85xlPpHMtxW6u2gE&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o85xlPpHMtxW6u2gE%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="179" frameborder="0" scrolling="no"><a href="https://medium.com/media/c15148c3e9ea2f5ab2b940e813535dff/href">https://medium.com/media/c15148c3e9ea2f5ab2b940e813535dff/href</a></iframe><p>In its <a href="https://www.wired.com/story/amazon-alexa-search-for-the-one-perfect-answer/">March 2019 issue, <em>Wired</em> discusses how voice recognition products</a> will be the go-to for half of the internet searches we make by 2020. However, Alexa only gives us one answer for each question and cannot succinctly describe to us how to learn multiple perspectives or learn more about a topic. I believe moving out of this one-shot answer world can be commercially desirable and will require human perspective.</p><p>Maybe someday a bot will look down at its cereal and say, hey there’s a human in my machine. I hope the thought will make it smile.</p><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_content=guest_post_image"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2IVAl0TbsfES9cFGYr40g.png" /></a></figure><p>📝 Read this story later in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=guest_post_read_later_text">Journal</a>.</p><p>🗞 Wake up every Sunday morning to the week’s most noteworthy Tech stories, opinions, and news waiting in your inbox: <a href="https://usejournal.com/newsletter/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=guest_post_text">Get the noteworthy newsletter &gt;</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c61d678c22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A case study with an Airbnb competitor: using feature engineering to best predict property price…]]></title>
            <link>https://medium.com/@sherzyang/a-case-study-with-an-airbnb-competitor-using-feature-engineering-to-best-predict-property-price-f83d33dc6a61?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/f83d33dc6a61</guid>
            <category><![CDATA[growth-strategy]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[real-estate]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Fri, 19 Apr 2019 17:31:14 GMT</pubDate>
            <atom:updated>2019-04-19T17:31:14.587Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>A case study with an Airbnb competitor: using feature engineering to best predict property price in King County</strong></h3><p>By: Mia Iseman and Sherry Yang<br><em>*Disclaimer: This is a fictional case study. It is in no way actually affiliated with any of the companies mentioned including Airbnb, Expedia, or HomeAway.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76sh5ug932pJOglOqdvq9w.png" /><figcaption>Airbnb is the current market leader in the hotel market. (<a href="https://www.recode.net/2019/3/25/18276296/airbnb-hotels-hilton-marriott-us-spending">Source</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Fe-3F1-ZKbz6yGjeuwWEg.png" /><figcaption>Airbnb is facing competition from Expedia. (<a href="https://skift.com/2018/11/14/airbnbs-growth-is-slowing-amid-increasing-competition-from-booking-and-expedia/">Source</a>)</figcaption></figure><p>Airbnb may have more share-of-voice in the hotel market today, but that doesn’t mean a better strategy from a lesser-known company couldn’t steal the stage in a growing market. HomeAway, an Airbnb and VRBO competitor, was recently acquired by Expedia, whose corporate offices are located in Bellevue, WA. This acquisition, along with a solid growth strategy, could prove to make HomeAway a leader in the King County, Washington market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPN4QRHy4DJLmuJkTPuiYw.png" /><figcaption>HomeAway was recently acquired by Expedia. (<a href="https://www.vrmintel.com/expedia-ceo-on-homeaway-we-bought-the-craigslist-of-vacation-rentals-skiftforum/">Source</a>)</figcaption></figure><p>The following is a fictional case for HomeAway based on a set of data property sale data from 2014–2015 for King County. The case aims to deliver a model predicting the property prices in King Country within 20 percent of actual property prices. HomeAway would like to know which neighborhoods are increasing in price so they can grow their presence in those locations. They want to know which properties will have high prices so they can modify internal budgets, sales territory strategies, and operations. We’ll be breaking down how we can model price by choosing property features using data science tools. We’ll focus on how feature engineering improves our model.</p><p>Our team iterated through the stages of a data science CRISP-DM process to create our property price model. These steps are: Business Understanding, Data Understanding, Data Preparation, Modeling, Evaluation, Deployment. We wanted to find what property features influence price the most and together would best predict property prices. Ultimately we chose six features as predictors in our property price model including:</p><ul><li><strong>Appeal</strong> which includes:<br><em>Grade</em>: grade has values 7, 6, 8, 11, 9, 5, 10, 12, 4, 3, and 13. This is the classification by construction quality which refers to types of materials used and quality of workmanship<br><em>Waterfront</em>: whether a property has a view of the waterfront<br>View: how many views outside a property has from inside<br><em>Condition</em>: has whole number values 1–5</li><li><strong>Square Ft Above</strong>: is the square footage of the house apart from the basement.</li><li><strong>Square Ft Living 15</strong>: The square footage of interior housing living space for the nearest 15 neighbors</li><li><strong>Center Districts: </strong>Distance from all points of interest, all recreational, suburbs, business centers</li><li><strong>Commerce Districts</strong>: Only distance from closest commerce district</li><li><strong>Square Ft Per Room</strong> which includes: <br><em>Square Ft Living</em>: footage of the home<br><em>Bedrooms</em>: number of bedrooms<br><em>Bathrooms</em>: number of bathrooms</li></ul><p>Our model predicts property price with a 15 percent error. How did we get to this? Using the data set as a starting point, we engineered three features that captured the question of when, where, and what would make a property price high. While not all of our engineered features made it into the final set of predictors, our methodology for examining features around the themes of location, quality and size orientated our processes nicely.</p><p>First we developed the feature seasonality.</p><p><strong>Seasonality </strong>— <em>We did not include this engineered feature in our final set of predictors</em>.</p><p><strong>Is the season of property purchase influential on the price? </strong>Our initial hypothesis was that prices for property sales in the winter were lower than prices in the spring, and we wanted to represent that effect in our model.</p><p>Our data came from a .csv file and was uploaded as a pandas DataFrame. We started by taking data in the date column, or date series, and converting them to a datetime entries.</p><pre>import pandas as pd<br>import numpy as np</pre><pre>#read the file as a dataframe<br>kc_df = pd.read_csv(&#39;kc_house_data.csv&#39;)</pre><pre>#Change the date column objects to be datetime entries. <br>kc_df.date = pd.to_datetime(kc_df.date, format=%m/%d/%Y&#39;)</pre><p>There are many ways to associate a date with its season. We looked at converting every date to its day in the year with January 1 as 1 (eg. January 28 would be converted to one measurement: 28).</p><pre>import datetime<br>def find_date(dates):<br>    &quot;&quot;&quot;Convert the date to a day number where Jan 1 = 0 and Dec 31 = 365&quot;&quot;&quot;<br>    output = []<br>    for date in dates: <br>        day_of_year = (date - datetime.datetime(date.year, 1, 1)).days + 1<br>        output.append(day_of_year)<br>    return output</pre><pre>date_series = pd.Series(find_date(kc_df[&#39;date&#39;]))</pre><pre>#drop the original date column from our dataframe<br>kc_df = kc_df.drop([&quot;date&quot;], axis=1)</pre><pre>#bucket the year into seasons<br>season_days = dict(<br>    winter=set(range(1,80)).union(set(range(352,367))),<br>    spring=set(range(80,171)),<br>    summer=set(range(171,264)),<br>    autumn=set(range(264,352)),<br>                   )</pre><pre>def find_season(days_from_jan1):<br>    &quot;&quot;&quot;Return the season as a string&quot;&quot;&quot;<br>    for season, days in season_days.items():<br>        if days_from_jan1 in days:<br>            return season</pre><p>We applied the find_seasons() function and then converted the categories to scores of 1 through 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*PysgeX1h_geEZsOA" /></figure><pre>#change the numbers to seasons<br>date_series = date_series.apply(find_season)</pre><pre>#add the season column to the dataframe <br>kc_df = pd.concat([kc_df, date_series], axis =1)<br>kc_df.rename(columns={0:&#39;season&#39;}, <br>                 inplace=True)</pre><pre>kc_df.loc[kc_df[&#39;season&#39;]==&#39;spring&#39;,&#39;season&#39;] = 1 <br>kc_df.loc[kc_df[&#39;season&#39;]==&#39;summer&#39;,&#39;season&#39;] = 2<br>kc_df.loc[kc_df[&#39;season&#39;]==&#39;autumn&#39;,&#39;season&#39;] = 3<br>kc_df.loc[kc_df[&#39;season&#39;]==&#39;winter&#39;,&#39;season&#39;] = 4</pre><p>In the end we did see that more sales were made in spring than in the winter. However we did not find that season was a top 6 influencing feature in our prediction of property prices. In our next iteration, we’d like to <a href="https://machinelearningmastery.com/how-to-one-hot-encode-sequence-data-in-python/">one hot encode</a> each season so we can better measure that season’s impact on prices, rather than the effect of all seasons on prices.</p><p><strong>Location</strong> — <em>We included this engineered feature in our final set of predictors.</em></p><p><strong>Where are the high value properties in King County located? How can we designate areas as desirable centers for commerce or leisure? Can the distance of a property from our created influential centers be good predictors for property price?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*VxvxrT2KTI6W61xu02QffQ.png" /></figure><p>Without local knowledge, we could use data science to help us understand neighborhoods. While we could assume that the locations of Amazon and Microsoft offices would be influential districts that increased the price around them, we can use data science to know for sure. After all, King County is huge! Our original hypothesis was that distance from downtown Seattle would be the most influential distance metric, but found that aggregate distances from commerce and leisure centers were much better predictors.</p><p>In our initial data set, we combine latitude and longitude into one feature called coordinates.</p><pre>coords = tuple(zip(kc_df.loc[:,&#39;lat&#39;], kc_df.loc[:,&#39;long&#39;]))<br>coordinates = pd.Series(coords)<br>kc_df[&#39;coordinates&#39;] = coordinates </pre><p>Next we asked, what areas have expensive houses? If the property is near an expensive area, we hypothesize that its location will affect the price of the home. To find expensive areas, we look at the median home value (as opposed to mean, thus lessening outliers’ effects) grouped by zip code.</p><pre>median_zip_prices_df.sort_values(by=[&#39;price&#39;]).tail(20)</pre><p>We looked at the zip codes with the twenty highest median property prices. Are they all near Seattle? Nope! We found that all these expensive areas are less than an average of six miles from the following areas: Downtown Seattle, Downtown Bellevue, Pine Lake, Magnolia, Woodinville, Kirkland, Tiger Mountain, Issaquah, and Redmond.</p><p>Then we created columns that contain the distance from these expensive areas. We used the <a href="https://pypi.org/project/haversine/">Haversine</a> formula to approximate distances between two points on earth. Haversine is most accurate with local distances as it imperfectly assumes the earth is a perfect sphere in its calculations of distances. We tried it out on distance from one center, downtown Seattle, and then a few others like downtown Bellevue and Pine Lake .</p><pre>from haversine import haversine</pre><pre>dt_seattle_mi = []<br>for row in kc_df.coordinates:<br>    a = haversine(row, downtown_seattle, unit=&#39;mi&#39;)<br>    dt_seattle_mi.append(a) <br>kc_df[&#39;seattle_dist&#39;] = dt_seattle_mi</pre><pre>dt_bellevue_mi = []<br>for row in kc_df.coordinates:<br>    a = haversine(row, downtown_bellevue, unit=&#39;mi&#39;)<br>    dt_bellevue_mi.append(a)<br>kc_df[&#39;bellevue_dist&#39;] = dt_bellevue_mi</pre><pre>pine_lake_mi = []<br>for row in kc_df.coordinates:<br>    a = haversine(row, pine_lake, unit=&#39;mi&#39;)<br>    pine_lake_mi.append(a)<br>kc_df[&#39;pine_lake_dist&#39;] = pine_lake_mi</pre><p>Some of these districts are more expensive than other districts, and so we have a hunch that grouping them together may make sense. For instance, being close to downtown Seattle may have a more widespread effect than being close to to Tiger State Park because of commerce and population sizes for those areas. So, we can judge the distance from each of these differently. We split the data into two sets based loosely on distance from <strong>commerce districts</strong> versus residential and recreation centers, or <strong>center districts</strong>. We made a decision to eliminate individual districts in favor of the aggregated districts as best predictors.</p><pre>#create a column of distances (mi) to the nearest commerce center</pre><pre>comm_distances = kc_df[[&#39;seattle_dist&#39;, &#39;bellevue_dist&#39;, &#39;redmond_dist&#39;]].min(axis=1)<br>kc_df[&#39;comm_dist&#39;] = comm_distances</pre><pre>#create a column of distances (mi) to the nearest center of any type </pre><pre>center_distances= kc_df[[&#39;seattle_dist&#39;, &#39;bellevue_dist&#39;, &#39;pine_lake_dist&#39;, &#39;magnolia_dist&#39;, &#39;woodinville_dist&#39;, &#39;kirkland_dist&#39;, &#39;tiger_mtn_dist&#39;, &#39;issaquah_dist&#39;, &#39;redmond_dist&#39;]].min(axis=1)</pre><pre>kc_df[&#39;center_dist&#39;] = center_distances</pre><p>We found these features to be our most novel and what we’d like to iterate on for future versions of our model.</p><p><strong>Appeal </strong>— <em>We included this engineered feature in our final set of predictors.</em></p><p><strong>What makes a property’s quality high? </strong>We suspected there were four factors, whether the property was close to a waterfront, how many views or sides of the house had views, the condition it was in and the grade it got for its quality of construction materials. We put these factors together into one feature called kc_looks_std. Our hypothesis was that the four features together would be a better predictor than one alone, and that grouping would allow us to include more feature considerations in our model with less overfitting.</p><pre>#import necessary library to use a standardscaler<br>from sklearn.preprocessing import StandardScaler</pre><pre>#scale the features<br>ss = StandardScaler()<br>kc_looks_std = kc_df[[&#39;grade&#39;, &#39;view&#39;, &#39;waterfront&#39;, &#39;condition&#39;]]<br>kc_looks_std = pd.DataFrame(ss.fit_transform(kc_looks_std),<br>                          columns = [&#39;grade_std&#39;, &#39;view_std&#39;, <br>                          &#39;waterfront_std&#39;, &#39;condition_std&#39;])</pre><p>When we added all of the appeal features together to create an appeal score, we found that grade was really valuable and so we gave it a higher relative value. We also gave waterfront a higher relative value.</p><pre>#create a formula to relate these values<br>kc_df[&#39;appeal_std&#39;]= kc_looks_std.apply(lambda x: 4*x[&#39;grade_std&#39;] + <br>                             x[&#39;view_std&#39;] + 2*x[&#39;waterfront_std&#39;] +       <br>                             x[&#39;condition_std&#39;],axis= 1)</pre><p>While we used the aggregate appeal feature in our model, in the future we’d like to consider not scaling categorical features.</p><p>We were able to choose our final six through examining how adding and subtracting features changed our median error between predicted and actual price. We used a feature selection tool from the <a href="https://machinelearningmastery.com/a-gentle-introduction-to-scikit-learn-a-python-machine-learning-library/">sklearn library</a>. What the feature selector does is help us look at all of the ANOVA f-statistics, which is a ratio of two variances, and return the best ones. A variance measures how far a set of numbers are spread out from their average value. A large f-statistic means that the variation among group means is more than we’d expect to see by chance, which is a good thing. We used the following code to look at the first three values in the best 6 features: appeal, square ft above, square ft living 15, center districts, commerce districts, and square ft per room.</p><pre>#import SelectKBest for feature selection<br>from sklearn.feature_selection import SelectKBest<br>from sklearn.feature_selection import f_classif</pre><pre>#set y to the target and X to all other features except target <br>y = np.ravel(kc_df[[&quot;price_log&quot;]])<br>X = kc_df.drop([&quot;price_log&quot;], axis=1)</pre><pre>#select the best price predictor features<br>X_new = SelectKBest(score_func=f_classif,k=7).fit_transform(X, y)</pre><pre>#return the first three values of the best 6 features<br>print(X_new[:3])</pre><p>These features can be seen in the current edition of our model. After testing and training the model, we can see it produces a median absolute error of approximately 0.15. This can be interpreted as a predicted property price using our model is typically 15 percent off of the actual property price.</p><pre>Current Model </pre><pre>ypred = (Sqft Above)x + (Sqft Living 15)x + (Commerce District)x + (Center District)x + (Sqft per Room)x + (Appeal)x + (Constant)</pre><p>What is wonderful about the field of data science is that the work is documented, repeatable in code by anyone, and can be used with other data sets. This was a great exercise in working between different data types. Our team looks forward to continuing to iterate and advance our model to increase our prediction accuracy and model value. In the future, we would also hope to work with current data spanning across more years to better capture changes in price across time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f83d33dc6a61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Top Book List]]></title>
            <link>https://medium.com/@sherzyang/my-top-book-list-a4e5aec07adf?source=rss-e86e1bcb017------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4e5aec07adf</guid>
            <category><![CDATA[fiction]]></category>
            <category><![CDATA[book-club]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[nonfiction]]></category>
            <dc:creator><![CDATA[Sherry Yang]]></dc:creator>
            <pubDate>Sat, 26 Jan 2019 01:08:13 GMT</pubDate>
            <atom:updated>2019-02-23T05:19:29.557Z</atom:updated>
            <content:encoded><![CDATA[<h3>My Top Books</h3><p>A great writing teacher of mine once started class by asking us to think if there was really a difference between fiction and nonfiction — if we even should use the word nonfiction at all. So whether these categories matter or not is up to the reader, it’s the authors that all have a tale to tell.</p><p><strong>10 fiction books I’ve read</strong></p><ol><li>White Teeth, by Zadie Smith</li><li>Americanah, by Chimamanda Ngozi Adichie</li><li>The Brief Wondrous Life Of Oscar Wao, by Junot Diaz</li><li>Sing, Unburied, Sing, by Jesmyn Ward</li><li>Red Rising, by Pierce Brown</li><li>One Flew Over The Cuckoo’s Nest, by Ken Kesey</li><li>Native Speaker, by Chang Rae Lee</li><li>Oryx and Crake, by Margaret Atwood</li><li>Lincoln In The Bardo, by George Saunders</li><li>One Hundred Years Of Solitude, by Gabriel Garcia Marquez</li></ol><p><strong>10 nonfiction books I’ve read</strong></p><ol><li>The Color Of Water, by James McBride</li><li>Atlas Of A Lost World: Travels In Ice Age America, by Craig Childs</li><li>The White Album: Essays, by Joan Didion</li><li>Killers Of The Flower Moon: The Osage Murders And The Birth of the FBI, by David Grann</li><li>Grit: The Power Of Passion and Perseverance, by Angela Duckworth</li><li>The New New Thing: A Silicon Valley Story, by Michael Lewis</li><li>#Girlboss, by Sophia Amoruso</li><li>Everybody Lies: Big Data, New Data and What the Internet Can Tell Us About Who We Really Are, by Seth Stephens-Davidowitz</li><li>Weapons Of Math Destruction, by Cathy O’neil</li><li>The Headspace Guide To Meditation and Mindfulness, by Andy Puddicombe</li></ol><p><strong>10 fiction books I want to read in 2019</strong></p><ol><li>Black Leopard, Red Wolf, by Marlon James</li><li>Fruit Of The Drunken Tree, by Ingrid Rojas Contreras</li><li>There, There, by Tommy Orange</li><li>Milkman, by Anna Burns</li><li>Once Upon A River, by Diane Setterfield</li><li>We Cast A Shadow, by Maurice Carlos Ruffin</li><li>Bangkok Wakes To Rain, by Pitchaya Sudbanthad</li><li>America Is Not The Heart, by Elaine Castillo</li><li>Gingerbread, by Helen Oyeyemi</li><li>To Keep The Sun Alive, by Rabeah Ghaffari</li></ol><p><strong>10 nonfiction books I want to read in 2019</strong></p><ol><li>Heavy, by Kiese Laymon</li><li>Becoming, by Michelle Obama</li><li>I’ll Be Gone in the Dark, by Michelle McNamara</li><li>Men We Reaped, by Jesmyn Ward</li><li>All You Can Ever Know, by Nicole Chung</li><li>CODE: The Hidden Language Of Computer Hardware and Software, by Charles Petzold</li><li>Sapiens: A Brief History of Mankind, by Yuval Noah Harari</li><li>The New Jim Crow: Mass Incarceration In The Age of Colorblindness, by Michelle Alexander</li><li>Dead Girls, by Alice Bolin</li><li>The Order Of Time, by Carlo Rovelli</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4e5aec07adf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>