<?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 Chris Chung on Medium]]></title>
        <description><![CDATA[Stories by Chris Chung on Medium]]></description>
        <link>https://medium.com/@chrispfchung?source=rss-46d54cf1b3ed------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*HHjW8WoEF-O08VV149aBRQ.png</url>
            <title>Stories by Chris Chung on Medium</title>
            <link>https://medium.com/@chrispfchung?source=rss-46d54cf1b3ed------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 14:13:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chrispfchung/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[The Coronavirus Bar Chart Race: The Race You Don’t Want to Win]]></title>
            <link>https://chrispfchung.medium.com/the-coronavirus-bar-chart-race-the-race-you-dont-want-to-win-1ce2aef80310?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ce2aef80310</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[flatten-the-curve]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Wed, 08 Apr 2020 04:16:31 GMT</pubDate>
            <atom:updated>2021-09-02T00:25:20.577Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Analysis</h4><h3>The Coronavirus Bar Chart Race: Don’t Even Compete</h3><h4>I created a Coronavirus bar chart race using Matplotlib. There is no winning in this race.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*39Sr1cemWPxBG57h" /><figcaption>Photo by <a href="https://unsplash.com/@freetousesoundscom?utm_source=medium&amp;utm_medium=referral">Free To Use Sounds</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I miss seeing people. I miss getting on the subway. I miss dinging the Citi Bike bell. Given that one of the #1 things on my mind is the Coronavirus, I went through this <a href="https://towardsdatascience.com/bar-chart-race-in-python-with-matplotlib-8e687a5c8a41">tutorial</a>, “Bar Chart Race in Python with Matplotlib” and created my own race using this updated COVID-19 <a href="https://www.kaggle.com/sudalairajkumar/novel-corona-virus-2019-dataset">dataset</a>.</p><p>In this blog post, I share my bar chart race, talk about my observations, and visualize the rapid growth of cases aboard the Diamond Princess cruise ship. You can follow along my code in Jupyter Notebook <a href="https://github.com/chrispfchung/coronavirus-barchartrace/blob/master/Coronavirus%20Bar%20Chart%20Race%20Notebook.ipynb">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Jth2s-0xwC_y9AdBuF__g.gif" /><figcaption>The Full Race — Total Confirmed Cases of Coronavirus from January 22 to April 5 2020</figcaption></figure><h3>The First Month</h3><p>The data starts from January 22nd. China’s confirmed cases are staggering compared to the rest of the world. At this point, the countries with the most cases are well below one hundred. Only after the first month do we see several Asian countries increase. However, South Korea, Italy and Iran’s numbers increase even faster, surpassing those countries.</p><p>For the first month, the rest of the world seems quiet. Looking back, it’s sad to know that death and pain would be waiting to happen. I’m imagine life going on as normal for others with the idea that “this wouldn’t happen to me.” If only we knew! <a href="https://www.washingtonpost.com/graphics/2020/world/corona-simulator/">Have you seen the Washington Post social distancing visual?</a> This could’ve been prevented (<em>Hindsight 20/20, right?)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1eW3FByazdrZqWIGC2lag.png" /><figcaption>Day 54</figcaption></figure><h3>Out of Control</h3><blockquote>By the second month, the rest of the world picks up at scary rates. And we see the appearance of the United States.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AhU4Pv-BsSDRU_qSPG803g.gif" /><figcaption>By day 65, The United States has the highest confirmed cases in the world</figcaption></figure><p>The United States violently overtakes the rest of the countries and is in a similar position as China during the first month. This is the race you do not want to win. We can see that South Korea, one of the earliest countries with the most confirmed cases, “flattened its curve.” One friend of mine, upon recently returning to South Korea, was tested, and put under mandatory self-quarantine. She was required to download an app that tracked her location. If she went too far out of her home location, an assigned government officer would contact her. This enforcement is justifiable as the data shows that this virus will ravage any country that reacts too slowly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*_8ZDeimktmorIZ--Kvehqw.png" /><figcaption>Rapid growth of Coronavirus cases onboard the Diamond Princess</figcaption></figure><h3>The Infected Diamond Princess</h3><p>This is a visualization of the Diamond Princess cruise ship’s daily growth of COVID-19 cases over time. It’s crazy to see the cases skyrocket. The boat, containing 3,711 passengers, reaches seven hundred cases in 2 weeks, or 18%. In other words, of a family of five, one will get the Coronavirus.</p><p>I think of the cruise ship’s thorough sanitary procedures like crew members spritzing disinfectant saying, “<em>washy washy,” </em>as well as trained medical staff on board. But a cruise ship is in the middle of the ocean with people in constant proximity of each other. Is the ship by its nature a place for disaster? What can cruise lines do to prevent this from happening again?</p><h3>Hope for all</h3><p>We’re still in this crisis and I hope to see the numbers stop increasing. I hope that the countries that just hit their 100th confirmed case this week are learning from what has happened and use our <em>hindsight 20/20</em> to save themselves. It’s not too late.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ce2aef80310" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing NYC Museums Map]]></title>
            <link>https://chrispfchung.medium.com/nyc-museums-map-3fb410dbd92b?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fb410dbd92b</guid>
            <category><![CDATA[museums]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nyc]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 09:27:25 GMT</pubDate>
            <atom:updated>2021-06-10T01:05:20.045Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data analysis</h4><h4>Which NYC museums are near you? A Tableau and Webscraping project.</h4><p>Over the last year I’ve enjoyed visiting art museums especially in NYC. It’s great to go with a couple of friends and get blown away by a huge range of creations. One day I’ll stand side by side with a massive steel sculpture and another I’ll squint my eyes at a tiny painting to scan over its intricate details. In NYC, there are many museums to visit, and I found an NYC <a href="https://catalog.data.gov/dataset/new-york-city-museums">public dataset</a> that gives the coordinates and address information for each one. I will plot them out with Tableau.</p><p>I also got more data to add context to the NYC dataset by getting the museum’s category and description so that you’ll know a little bit more about the museum when you look at the map. I webscraped museums on <a href="https://en.wikipedia.org/wiki/List_of_museums_in_New_York_City">Wikipedia </a>and supplemented the public dataset with as much data as possible.</p><p><a href="https://github.com/chrispfchung/nyc-museum-map/blob/master/NYC%20Museums%20Map%20Blog.ipynb">You can follow along with my code from my Jupyter Notebook here.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cFZiL4Hd3eLQm1Nm" /><figcaption>Photo by <a href="https://unsplash.com/@igormiske?utm_source=medium&amp;utm_medium=referral">Igor Miske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Below is a map of NYC Museums. Plentiful from midtown upwards. We’ll look closer into each area.</h4><p>Interact with the map on Tableau <a href="https://public.tableau.com/profile/christopher.chung1603#!/vizhome/NYCMuseumMap/Dashboard1?publish=yes">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*sH7XcIsG0kkTw_vCnKmLBg.png" /><figcaption>Location of NYC Museums</figcaption></figure><h3>Lower East Museums</h3><p>There is a handful across Lower East Side along the same latitude.I think I could take a weekend to visit that cluster. Some of the museums on the Lower East include: The Tenement Museum, The Italian American Museum, and the Children’s Museum of the Arts. I’ve highlighted details of the New Museum below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*BC73owZwZgQSIRL03r15eA.png" /><figcaption>Lower East Side Museums</figcaption></figure><h3>FiDi Museums</h3><p>Towards the end of the island, we have the Museum of Jewish Heritage and the Skyscraper Museum. We also have the American Indian museum and the 9/11 Museum. Off the island, we have Ellis Island Statue of Liberty as well as a sprinkle of Brooklyn museums. I haven’t visited any of the museums there but I heard the Brooklyn Museum is amazing. Will visit soon!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*dlhcCFFmgcrXqgGEm1JXRw.png" /><figcaption>FiDi Museums</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9mmxVXuADChXzGmi" /><figcaption>Photo by <a href="https://unsplash.com/@coryoliver?utm_source=medium&amp;utm_medium=referral">Cory Oliver</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Midtown and Upper NYC Museums</h3><p>We have many midtown to Upper East Side museums and within Central Park the beautiful, legendary MET as well as more modern art at the Whitney Museum. Even higher up we have regional and traditional focused art including the The Studio Museum and the Jazz Museum in Harlem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*5laiCliOdnOQeoI04Oj51A.png" /><figcaption>Mid-Upper New York Museums</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ThZbdRFDwDhetDSK" /><figcaption>Photo by <a href="https://unsplash.com/@aginsbrook?utm_source=medium&amp;utm_medium=referral">Anthony Fomin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Data</h3><p>After collecting more data to add to the public dataset, 52/132 or 39% of my museum data points have location details, a description and/or a category (some are still missing). The rest, 50/129 or 61% of my data contain only name location details. After I scraped the Wikipedia link of NYC museums and filled in missing data on Excel, I wasn’t able to get the last 79 without googling each address. On the<a href="https://public.tableau.com/profile/christopher.chung1603#!/vizhome/NYCMuseumMap/Dashboard1?publish=yes"> interactive map</a>, toggle “Null” on the interactive map to see the rest of the data points without descriptions.</p><h3>What Museums Mean To Me</h3><p>Visiting museums has helped me envision differently and wonder beyond what I can imagine. I’m glad that there are so many establishments and galleries across NYC that allow me to learn about other cultures and enjoy a different way to see the world. Thank you.</p><p><a href="https://public.tableau.com/profile/christopher.chung1603#!/vizhome/NYCMuseumMap/Dashboard1?publish=yes"><strong>Explore the map here</strong></a></p><p><a href="https://github.com/chrispfchung/nyc-museum-map/blob/master/NYC%20Museums%20Map%20Blog.ipynb">You can see my Python code from jupyter notebook here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fb410dbd92b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring 2 Months of NYC Bike Accidents]]></title>
            <link>https://medium.com/data-science/exploring-2-months-of-bike-accidents-in-nyc-897d280951d5?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/897d280951d5</guid>
            <category><![CDATA[nyc]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[citi-bike]]></category>
            <category><![CDATA[safety]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 15:51:57 GMT</pubDate>
            <atom:updated>2021-01-25T01:59:20.783Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Analysis</h4><h4>NYC biking can be dangerous because of aggressive driving and an overwhelming amount of cars. But as we’ll soon see, they’re not the only…</h4><p>I’ve been riding Citi Bikes for a year now and it’s hands on the handles my favorite way to get around NYC. I think it’s so convenient and fun to zoom around the streets and enjoy the city’s amazing atmosphere. I’m thankful for the plethora of bike docks and safe bike lanes that allow me to have these experiences.</p><p>On the contrary, NYC biking can be dangerous because of aggressive driving and an overwhelming amount of cars. In this blog post, I look into an NYC public dataset of collisions involving bikes in Manhattan in January and February 2020. Furthermore I look closer into the details to see why these accidents occurred and what vehicles were involved. We’ll soon see that it may not be the drivers and cars that are the only problems.</p><p><a href="https://github.com/chrispfchung/nyc-bike-collision-analysis/blob/master/Biking%20Collision%20Analysis%20.ipynb">You can read along my code in my jupyter notebook here.</a></p><h3>The NYC Motor Vehicle Collision Dataset</h3><p>The original data source is <a href="https://data.cityofnewyork.us/Public-Safety/Motor-Vehicle-Collisions-Crashes/h9gi-nx95">NYC public safety motor vehicle collision crashes</a>. The data shows the exact location of accidents, why they occurred, what vehicles were involved, number of cyclists hurt, time and date of crash. I filtered January and February 2020 accidents in Manhattan and used python pandas to keep only the rows with bicyclists that were either injured or killed (In my data, there were no deaths, fortunately!) The dataframe contains 65 accidents. Here are screenshots of the first 5 rows in two parts. Let’s look at what the data is showing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-bjJ5hQfknnQAh-pmQHiJQ.png" /></figure><ol><li><em>Vehicle_type_code_1</em> (first party involved in accident aka vehicle 1) refers to the specific vehicle involved.</li><li><em>Contributing_factor_vehicle_1</em> is the reason why vehicle 1 contributed to the accident. It contains reasons like turning improperly, driver inattention/distraction and backing unsafely.</li><li><em>Vehicle_type_code_2</em> and <em>Contributing_factor_vehicle_2 </em>mean the same thing as vehicle 1 but the second party involved.</li></ol><p>Let’s analyze our data.</p><h3>What’s Causing The Accidents?</h3><p>The dataset is organized with vehicle 1 (a driver or biker) as the cause of the accident while occasionally vehicle 2 (the other driver or biker) is blamed as well e.g. both drivers were distracted.</p><p>56/65 or 86% of accidents had contributions from vehicle 1 drivers because of:</p><pre><strong>Driver Inattention/Distraction                           19<br>Unspecified                                              11<br>Passing or Lane Usage Improper                            6</strong><br><strong>Passenger Distraction                                     4<br></strong>Pedestrian/Bicyclist/Other Pedestrian Error/Confusion     3<br>Failure to Yield Right-of-Way                             3<br>Turning Improperly                                        2<br>Following Too Closely                                     2<br>Backing Unsafely                                          2<br>Passing Too Closely                                       1<br>Traffic Control Disregarded                               1<br>Unsafe Lane Changing                                      1<br>Driver Inexperience                                       1</pre><p>The top reason was driver inattention at 19/56 or 34% and reason “unspecified” in second place. We’ll talk a little about unspecified later. Other reasons include passing, lane usage improper and passenger distraction.</p><p>It’s interesting to read through the lists of reasons to be more aware of these possibilities so that I can be even safer when I’m biking. With 4/56 or 7% of accidents from distracted passengers, I can only imagine how this could’ve cause the accident. Playing music too loud? Talking too much to the driver? Passenger rage towards biker?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HD0_PJtZoJ9ZwIgb" /><figcaption>Photo by <a href="https://unsplash.com/@odiin?utm_source=medium&amp;utm_medium=referral">Erik Odiin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>And It’s Not Just Drivers</h3><p>Vehicle 1 consists not only of drivers but bikers too. 9/65 or 14% of vehicle 1 category were made up of bikers with accidents caused because of:</p><pre>Driver Inattention/Distraction    6<br>Aggressive Driving/Road Rage      1<br>Passing Too Closely               1<br>Unspecified                       1</pre><p>The top reason was biker inattention/distraction at 67%. The second and third reason are aggressive <em>biking / rage and passing too closely.</em> <strong>Lessons learned: Pay attention, keep a cool head, and get space!</strong></p><p>As for “unspecified” reasons by the biker, the reason is also unspecified or missing a reason for vehicle 2, the second party. I assume that there could’ve been a multitude of reasons like unable to conclude what the exact cause. It would be interesting to know the circumstances to lead to two unknown reasons.</p><p>On the other hand, these are some of the reasons how the accidents were caused by <em>both parties</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*4t8zygbIZNa-sB_qMXJr_w.png" /></figure><p>The majority of reasons is that both drivers were distracted or not paying attention. Other combinations are cars backing up unsafely while the bike was too close or some kind of error or miscalculation from either driver or biker that caused the accident. Some of the other accidents were caused by Pedestrian/Bicyclist/Other Pedestrian Error. I was wondering what this could possibly be but when I spoke about these accidents with a friend, she told me a personal story. There was a time she was crossing the street texting and did not notice an incoming bicyclist heading her way. The bicyclist tried to avoid her and crashed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s-s29Sb_Wp6uLzpa" /><figcaption>Photo by <a href="https://unsplash.com/@epicantus?utm_source=medium&amp;utm_medium=referral">Daria Nepriakhina</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Who is Most Responsible For The Accidents?</h3><p>Let’s look at what vehicles were involved in the overall accidents.</p><pre>Taxi                                   20<br>Station Wagon/Sport Utility Vehicle    16<br>Bike                                   14<br>Sedan                                  13<br>Pick-up Truck                           2<br>Box Truck                               2<br>Van                                     1<br>Armored Truck                           1<br>Bus                                     1</pre><p>About 30% of the accidents were caused by taxis, 24% caused by station wagon or SUVs, and 20% of accidents were caused by the bikers! Let’s look closer into how Taxis caused the most accidents.</p><pre><strong>Driver Inattention/Distraction                           6<br>Passing or Lane Usage Improper                           4<br></strong>Unspecified                                              3<br>Following Too Closely                                    2<br>Passenger Distraction                                    2<br>Pedestrian/Bicyclist/Other Pedestrian Error/Confusion    2<br>Traffic Control Disregarded                              1</pre><p>Again driver inattention and distraction as well as improperly lane passing. Speaking for myself, I should be careful not to assume vehicles can see me and remember to pass them with caution. New Yorkers taxi drivers are notorious for cutting into lanes without signaling and changing lanes too close to other vehicles. One bad move from the taxi driver or a biker could cause serious injuries!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GSb4h0dBssuLsmpO" /><figcaption>Photo by <a href="https://unsplash.com/@thevisualiza?utm_source=medium&amp;utm_medium=referral">Dil</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Watch Out!</h3><p>Finally I’m also interested in seeing if there were any bike to bike collisions. In 65 accidents, there was only one where one biker passed too closely. Only one biker was injured. Maybe one biker assumed to have enough space to pass by a slower biker but ultimately got too close and caused the crash. I’ll keep my space.</p><h3>Next Steps</h3><p>I love we can look at this data and use our imagination to see how the accident might have happened. 2 months of data already gives me a glimpse of NYC bike safety today. With more months in the analysis, we could start to see more trends. My analysis of these events is helpful to me to understand the ways that I could get into an accident. The reasons above are just a handful of causes but it has also helped me know what else to be aware of as I’m biking. In a future post, I will dive further into this dataset and plot out the crashes along with my Citi Bike trips to learn about my proximity to the accidents. Thanks for reading.</p><p><a href="https://github.com/chrispfchung/nyc-bike-collision-analysis/blob/master/Biking%20Collision%20Analysis%20.ipynb">Come see my jupyter notebook to see how I coded my analysis in Python</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=897d280951d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/exploring-2-months-of-bike-accidents-in-nyc-897d280951d5">Exploring 2 Months of NYC Bike Accidents</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[Pyautogui and a “Likeable” Application]]></title>
            <link>https://chrispfchung.medium.com/pyautogui-and-a-likeable-application-1cf01903e2a2?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cf01903e2a2</guid>
            <category><![CDATA[pyautogui]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Wed, 19 Dec 2018 15:44:46 GMT</pubDate>
            <atom:updated>2019-03-06T17:13:34.293Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Thank you… motion sensor hand towel machine. You never work, so I just end up looking like I’m waving hello to a wall robot.<br>-Jimmy Fallon via <a href="https://www.brainyquote.com/quotes/jimmy_fallon_593151?src=t_robot">BrainyQuote</a></blockquote><p>I’ve been interested in the automation of our tasks. One of my most memorable inspirations was the scene in the “Green Hornet” where Jay Chou, playing tech-savvy Kato, makes an amazing cup of latte that you can practically taste and smell through the screen, using a beautiful, complicated-looking coffee machine (that he built!) by pushing a few buttons and pulling a few levers!</p><p>I also remember when I came out of college and worked a temporary job that primarily had me entering data, which I found very boring. I wish there was a program to do that work for me! (there are but we won’t cover that here).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*SrcUZr1nPmbTLT7mA8XH_w.gif" /><figcaption>Brb getting a <a href="https://www.youtube.com/watch?v=B_P9Pzjbanc">latte</a></figcaption></figure><p>I recently picked up a book called “Automate the Boring Stuff with Python,” by a very funny and smart guy named Al Sweigart. In his book, he talks about how you can do really cool things using Python like creating watermarks on a large number of photos at the same time and controlling your mouse and keyboard through a GUI. I will be talking about the latter topic in this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*0AK_Q6UZXa5VJ-IXvcSqkw.png" /><figcaption>via <a href="http://automatetheboringstuff.com/">Automate the Boring Stuff</a></figcaption></figure><p>In this book, Sweigart covers controlling the mouse and keyboard with a module that he created called “PyAutoGui.” With this module, you can program your computer to do things like move your mouse to a specified spot, open programs for you at a chosen time, scroll up and down pages and many other applications. The first time I messed with PyAutoGui, I was mind-blown when my cursor instantaneously moved to a coordinate on my screen, all by itself! It almost felt like I was sharing my screen with someone that had full access to my computer. From there I was hooked- now I wanted to see what else I could do it. How about creating a script that likes all of someone’s Instagram posts?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*3sfZHf2ehRX-hQmKSbFPoQ.gif" /><figcaption><em>via </em><a href="https://www.google.com/url?sa=i&amp;source=images&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjwvMjpp6rfAhWETd8KHeW0DPkQjB16BAgBEAQ&amp;url=http%3A%2F%2Fwww.webmasto.com%2Finstagram-etkilesiminizi-nasil-arttirirsiniz%2Finstagram-like-gif&amp;psig=AOvVaw0qvOMkmOBhD1MJNwEdf8dt&amp;ust=1545254496652572">WebMasto</a></figcaption></figure><p>First I wanted to understand how the computer screen coordinates work. On Sweigart’s PyAutoGui site, the docsclearly explains how to use it. On a 1440x900 screen, coordinates (0,0) would be the top left corner of your screen and (1439,899) would be the bottom right corner. One important note is that when you pull the curser down the screen, the coordinate <strong>increases. </strong>Here is a diagram of the screen and how to read the coordinates on a 1920x1080 screen taken from the <a href="https://pyautogui.readthedocs.io/en/latest/mouse.html">site</a>.</p><pre>0,0       X increases --&gt;<br>+---------------------------+<br>|                           | Y increases<br>|                           |     |<br>|   1920 x 1080 screen      |     |<br>|                           |     V<br>|                           |<br>|                           |<br>+---------------------------+ 1919, 1079</pre><p>When I first started thinking about how I would do this, I tested its applications by manually inputting the coordinates of where to click and how many times it would click. I had a friend’s Instagram pulled up on my laptop.</p><pre>pyautogui.moveTo(35,689)<br>pyautogui.click(clicks=4, interval=0.5)<br>pyautogui.press(&#39;right&#39;)<br>pyautogui.moveTo(135,621)<br>pyautogui.click(clicks=3, interval=0.5)<br>pyautogui.press(&#39;right&#39;)<br>pyautogui.moveTo(134,568)<br>pyautogui.click(clicks=3, interval=0.75)<br>pyautogui.press(&#39;right&#39;)</pre><p>This code block essentially moved to the Instagram heart’s coordinates, clicked it, and then moved to the next page. <em>Pyautogui.moveTo()</em> tells the mouse to go to that coordinate. <em>Pyautogui.click(), </em>where there are adjustable parameters,<em> </em>clicks<em> </em>the specified number of times and waits 0.5 between each click. <em>Pyautogui.press()</em> presses the specified key. Very intuitive! Because this code was written manually, this method will too long especially when the location of the Instagram heart moved after every next photo. The next step shows you how Pyautogui locates each heart automatically using <em>Pyautogui.locateOnScreen()</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/43/1*R8k-IaMAjeAmd9boyC3q2w.png" /><figcaption>Instagram Heart.png</figcaption></figure><p>With this method, you need have a photo saved on your computer where you can access it by inserting it into its parameter. Essentially it searches for the exact picture down to the pixel. If even one pixel is off, it will return None and the code will break. First I screen-shotted the heart, then I entered the file name like so <em>Pyautogui.locateOnScreen(heart.png). </em>After the heart is located, I used another method called <em>Pyautogui.center(‘heart.png’) </em>that centered the cursor on the heart. Afterwards I created a loop that clicks the heart and presses the ‘right’ direction key to get to the next photo.</p><p><strong>Next Steps</strong></p><p>Now that it can like all of someone’s posts, I could potentially have it leave a comment at the end of the posts, leave the screen, go to your mutual friends, and find another person’s Instagram page to like. Although this was a simple project using only python, it’s interesting to note that people would pay for this type of bot service to automatically follow people, leave many many comments, and post pictures on its own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cf01903e2a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recommendation Systems and How to Create a Simple one with Python]]></title>
            <link>https://chrispfchung.medium.com/recommendation-systems-and-how-to-create-a-simple-one-with-python-b8822659aa08?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8822659aa08</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Tue, 04 Dec 2018 18:07:20 GMT</pubDate>
            <atom:updated>2018-12-05T02:23:23.638Z</atom:updated>
            <content:encoded><![CDATA[<p>Recommendation Systems and How to Create a Simple one with Python</p><p>I used to sell luxury watches in a retail environment. My job was to use my knowledge of customers and convince them to splurge. In retrospect, I was constantly filtering and sorting customer information then drawing conclusions on how to construct my next sales approach. Today, many companies use algorithms to do the same thing with recommendation systems. It’s fascinating that companies are able to ell you what you want before you knew it and without ever seeing your face. In this blog post I’m going to briefly talk about how companies YouTube and Ant Financial use their recommendation system to great effect and show you a simple movie recommendation system using numpy and pandas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*kg9p2NVTpLsukszHe6Tqxg.jpeg" /><figcaption>Old-fashioned Recommendation System</figcaption></figure><p>YouTube has been an exceptional resource for learning and watching anything under the sun but it’s also a place where you can spend too many hours on it if you’re not careful. There have been many nights where I went to watch a video and emerged an hour later in a daze wondering what just happened. Needless to say, YouTube has done a great job at keeping viewers longer and longer on their site. What recommendation systems have they implemented to keep us watching for longer? Google Brain, their parent company’s artificial intelligence division, turned to unsupervised learning. YouTube uses Google Brain’s machine learning algorithms to find relationships and patterns that software engineers would not have seen, providing more useful recommendations on its own and at an accelerated rate. The patterns they’ve picked up have made a significant improvement in viewership.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ztj6nr4Q7ryzrScbLolNDQ@2x.jpeg" /><figcaption><em>via </em><a href="https://venturebeat.com/2017/04/04/vb-summit-welcomes-the-chuck-norris-of-google/"><em>VentureBeat</em></a></figcaption></figure><p>In the past, YouTube relied on algorithms that put videos with the most clicks in front of more viewers. However, with Google Brain’s unsupervised learning algorithms, they realized that the amount of time a user spent watching a video was a much better indicator of a higher quality video. Another way is recommending longer times on YouTube’s TV app and shorter times on its mobile app. This helped boost view duration as people on their mobile phone tend to be on the go while people on the TV app stayed in one place. In this same effect, the ad times were shorter on mobile and longer on the TV.</p><p>We should be careful not to look too closely at the most obvious things because I think we can get attached to one way of thinking and not see another pattern. It’s great that machine learning algorithms are able to detect these relationships and help us make impactful changes. Another company that is using recommendation systems is Ant Financial.</p><p>Ant Financial is the financial affiliate of Alibaba Group Holding. I found this company very interesting because while I was doing research on this company, I realized that when I was in China, I was using it every single day. They’re behind Alipay, a third-party mobile and online payment platform in China. People have stopped using cash because of its popularity. I never needed to bring a wallet out. All you do is put money on your e-wallet and scan the terminal’s QR code and you’re good to go. Convenience is king.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*BLtPtGCD5Bgxz_b4QjAmDA.jpeg" /><figcaption>Via <a href="https://www.pymnts.com/news/payment-methods/2015/wirecard-powers-alipay-payments-in-europe/">Pymnts</a></figcaption></figure><p>You can basically buy anything on Alipays’ platform. Shop owners, restaurant owners online stores, rice paddy grandmas, are all using the app. When over 500 million people are using the same platform, you have a huge amount of transactional data. What do they do with this data to create a very good recommendation system? Instead of the traditional recommendation system such as collaborative filtering, where the algorithm deduces that since love pineapples, you might like mangos because someone else who pineapples also likes mangos, or content-based filtering where it recommends you other tropical fruits, Ant Financial provides a two-way recommendation system that connects you to the businesses. Michael Jordan, professor at UC Berkeley and a prominent leader in machine learning, goes into more detail about this. Say you just come out of a movie and you’re looking for a restaurant to eat at nearby.</p><p>On your app, it would say here’s some restaurant nearby that you might like and some you’ve been to, and on the restaurant sides app, the restaurant owners might be holding a wedding so there might be 50 empty seats so they put down this down in their preferences. Since you’re nearby this particular restaurant, they can send you discounts and special offers to entice you to eat there tonight. One those 50 seats are filled, great! Now you’re happy you’re full and you saved some money AND the restaurant filled to capacity. And this creates a market because when that restaurant is full, other restaurants in the area see this and can also make special offers to fill their seating as well. It’s a win-win for you, the businesses and the economy. Jordan says that this is “democratizing financial services” and “it’s all about providing to the right people at the right time.”</p><p>Now this is a simple python recommendation system using numpy and pandas which will return similar movies based on rating correlation in order to find the similarity between movies. First showing that the higher number of ratings a movie gets is related to the average rating it receives as more people tend to watch these movies. Then using rating correlation, where users who voted the same for both movies would strengthen the correlation, to show similar movies. We will be using the <a href="https://grouplens.org/datasets/movielens/latest/">MovieLens</a> dataset which consists of 100,000 ratings of 9,000 movies by 600 users last updated 9/2018. This part is following the walkthrough of <strong>Usman Malik</strong> in this <a href="https://stackabuse.com/creating-a-simple-recommender-system-in-python-using-pandas/">post</a>.</p><p>First the author explored the MovieLens data. We open the ratings and movies .csv’s in the dataset with pandas. We name them ‘ratings_data’ and ‘movie_names’. We merge the two together.</p><pre>movie_data = pd.merge(ratings_data, movie_names, on=&#39;movieId&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*ha8A1hCaZmrYT0PIfyuLAg.png" /></figure><p>Then we take the mean of each of the ratings and average them.</p><pre>movie_data.groupby(&#39;title&#39;)[&#39;rating&#39;].mean().sort_values(ascending=False).head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*J2Ber9gUYi2s6vZP2SOhqQ.png" /></figure><p>Because these movies can reach the top as the highest rated movies because they only have 1 review, we should also get the number of ratings per movie. The authors main point was that “really good movies get higher ratings because it is rated by a large number of users.”</p><pre>movie_data.groupby(&#39;title&#39;)[&#39;rating&#39;].count().sort_values(ascending=False).head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*EgNoKjUiVvN1LgRSKHuooQ.png" /></figure><p>The really well known movies are now at the top of the list. And it may be safe to say that these are also very good movies. Next, we’ll add the rating count and the rating tables together.</p><pre>ratings_mean_count[&#39;rating_counts&#39;] = pd.DataFrame(movie_data.groupby(&#39;title&#39;)[&#39;rating&#39;].count())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*kxxu4XvGJUQQcGcXWRICyw.png" /></figure><p>Here above we have the rating and the number of ratings next to the title of the movies. To illustrate the amount of movies with or without ratings, we’ll plot it out on a histogram.</p><pre>sns.set_style(&#39;dark&#39;)<br>%matplotlib inline</pre><pre>plt.figure(figsize=(8,6))<br>plt.rcParams[&#39;patch.force_edgecolor&#39;] = True<br>plt.title(&#39;Movies and Ratings Counts&#39;)<br>plt.ylabel(&quot;Number of Movies&quot;)<br>plt.xlabel(&quot;Number of Ratings per Movie&quot;)<br>ratings_mean_count[&#39;rating_counts&#39;].hist(bins=50)<br>#graphing number of movies that received x amount of ratings</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*l_zbGZOHI33-sh0MYHBH1w.png" /></figure><p>This shows there are many movies that have 0 ratings and very few that have over 100 ratings (can’t even see it on the graph).</p><pre>plt.figure(figsize=(8,6))<br>plt.rcParams[&#39;patch.force_edgecolor&#39;] = True<br>plt.title(&#39;Movies and Average Rating&#39;)<br>plt.xlabel(&quot;Average Rating per Movie&quot;)<br>plt.ylabel(&quot;Number of Movies&quot;)<br>ratings_mean_count[&#39;rating&#39;].hist(bins=50)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*2bQUH7jhv4b620bGwgAIwQ.png" /></figure><p>The graph shows that the higher the amount of ratings the average rating tends to be higher.</p><pre>plt.figure(figsize=(8,6))<br>plt.rcParams[&#39;patch.force_edgecolor&#39;] = True<br>sns.jointplot(x=&#39;rating&#39;, y=&#39;rating_counts&#39;, data=ratings_mean_count, alpha=0.4)<br>#movies with higher avg rating have more ratings</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*3eQtva2Qd4RZ6MCfbMqwMA.png" /></figure><p>This puts the two graphs together to show that the more well known a movie is, the more people watch it, therefore has a higher rating. Now to find the similarities between the movies.</p><pre>user_movie_rating = movie_data.pivot_table(index=&#39;userId&#39;, columns=&#39;title&#39;, values=&#39;rating&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*cfq5rKwqMny-Xj8QW5HxpA.png" /></figure><p>This is a matrix with each movie and their ratings. Many of them have had no votes so there are NaN. We will choose Forrest Gump to be our base movie because it has the highest amount of ratings and then find other movies that are highly correlated with its rating. We will clean this data by removing the NaN in the next steps.</p><pre>forrest_gump_ratings = user_movie_rating[&#39;Forrest Gump (1994)&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*tGLBe8pru7-7Ri8lOqSQMA.png" /></figure><p>These are the user ratings for the movie Forrest Gump. Using the corrwith() method we can find the correlation of other movies that rated the same thing for Forrest Gump.</p><pre>movies_like_forrest_gump = user_movie_rating.corrwith(forrest_gump_ratings)</pre><pre>corr_forrest_gump = pd.DataFrame(movies_like_forrest_gump, columns=[&#39;Correlation&#39;])<br>corr_forrest_gump.dropna(inplace=True)<br>corr_forrest_gump.head()<br>corr_forrest_gump.sort_values(&#39;Correlation&#39;, ascending=False).head(10)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*fd4cWw_nHvg3sSzP2Ks-WQ.png" /></figure><p>A lot of these movies are unheard of. Although the correlation is 1.0, a movie with one rating is not as a good of an indicator as one with more ratings. So, we filter out the movies with less than 50 review counts.</p><pre>corr_forrest_gump[corr_forrest_gump [&#39;rating_counts&#39;]&gt;50].sort_values(&#39;Correlation&#39;, <br>                                                                      ascending=False).head(10)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*b6LKrTM2wyxN6C6VrBK_gA.png" /></figure><p>The final results shows other movies that are also very similar as they are big Hollywood movies, showing movies that they are pretty correlated, taking into account the rating count and average rating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*1-LXaApZ7VkoeyOvxuLzcA.gif" /><figcaption>Via <a href="http://www.reddit.com/r/reactiongifs/comments/1s08fj/mrw_i_anonymously_give_gold_to_a_comment_with_2/">Giphy</a></figcaption></figure><p>Sources:</p><p><a href="https://www.forbes.com/sites/kristinwestcottgrant/2017/12/10/how-to-think-about-artificial-intelligence-in-the-music-industry/#2938bfc37d4a">https://www.forbes.com/sites/kristinwestcottgrant/2017/12/10/how-to-think-about-artificial-intelligence-in-the-music-industry/#2938bfc37d4a</a></p><p><a href="http://www.ieor.berkeley.edu/~goldberg/pubs/eigentaste.pdf">Eigentaste: A Constant Time Collaborative Filtering Algorithm</a>. Ken Goldberg, Theresa Roeder, Dhruv Gupta, and Chris Perkins. Information Retrieval, 4(2), 133–151. July 2001.</p><p><a href="https://stackabuse.com/creating-a-simple-recommender-system-in-python-using-pandas/">https://stackabuse.com/creating-a-simple-recommender-system-in-python-using-pandas/</a></p><p><a href="https://www.forbes.com/sites/bernardmarr/2017/08/08/the-amazing-ways-how-google-uses-deep-learning-ai/#2aaa6e713204">https://www.forbes.com/sites/bernardmarr/2017/08/08/the-amazing-ways-how-google-uses-deep-learning-ai/#2aaa6e713204</a></p><p><a href="https://www.theverge.com/2017/8/30/16222850/youtube-google-brain-algorithm-video-recommendation-personalized-feed">https://www.theverge.com/2017/8/30/16222850/youtube-google-brain-algorithm-video-recommendation-personalized-feed</a></p><p><a href="https://www.businessinsider.com/youtube-watch-time-vs-views-2015-7">The &#39;terrifying&#39; moment in 2012 when YouTube changed its entire philosophy</a></p><p><a href="https://grouplens.org/datasets/movielens/latest/">https://grouplens.org/datasets/movielens/latest/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8822659aa08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sharing our data, Improving our cities]]></title>
            <link>https://chrispfchung.medium.com/sharing-our-data-improving-our-cities-2760ad353d05?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/2760ad353d05</guid>
            <category><![CDATA[uber]]></category>
            <category><![CDATA[sharedstreets]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Fri, 16 Nov 2018 08:17:29 GMT</pubDate>
            <atom:updated>2018-11-24T06:09:31.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*v_YvtR4NOoMvLNzZsYwQlA.png" /><figcaption><em>Via cnet.com</em></figcaption></figure><blockquote>“Code is the new concrete for 21st century cities and we need a digital infrastructure to share data and create safer and more sustainable streets.”</blockquote><blockquote>-Janette Sadik-Khan, former commissioner of the New York City Department of Transportation and an advisor on transportation and urban issues.</blockquote><p>Ever since the advent of rideshare services, I’ve felt that it’s improved my life. I don’t have to feel awkward getting wave-rejected as an occupied taxi whizzes past me and I can avoid shady taxi drivers from taking me on the longest route possible. Ridesharing services have done me a great service and I think it’s fair to say that they’re doing very well for themselves too. But are companies doing any good for the world? Just last year, Uber, Ford and Lyft have partnered up with a company called SharedStreets to give city mayors across the world “unparalleled access to their road traffic data” in order to help cities rethink transportation.</p><p>Cities are trying to improve urban mobility but are unable to because their street maps are inadequate to deal with the super surge of cars taking up limited space. One very valuable space is the curb. People get dropped off there, bicyclists use it, cars park on it, and trucks unload there. It’s a crucial pain point not only for pedestrians and drivers who deal with constant delays from people blocking traffic but also for many businesses because freight and logistics companies are using the curb more and more and they have no way to collaborate well with the city. Many cities don’t have their infrastructures mapped out well and even more of a problem is that they don’t have enough data to make any actionable changes.</p><p>Ridesharing companies have a huge amount of data that cities could use to make traffic efficient and safer. For this cities-companies collaboration, Uber and Lyft provided a substantial amount of trip information including fare amount, vehicle speed data, pick up, and drop off data. However, even if these companies provided data to the cities, their street level data sets are still not compatible. Not only are city mapping systems different each other (the city of Detroit has cities within that all have their own way of managing their infrastructure), they’re also different from ridesharing companies.</p><p>SharedStreets makes it possible by creating an open-source, universal map language in a simple machine readable format that everyone — the city, companies and citizens — all have access to. And because SharedStreets is a third party, non-political, and non profit, Uber and Lyft do not need to fear risking proprietary secrets such as routing algorithms and SharedStreets removes thecompany name from the trips. Regarding our privacy, SharedStreets uses data in a way that is completely unrelated to the privacy of people. This allows all data to work in everyone’s favor without jeopardizing anyone’s interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*APzbXe5IdRclM8x_.png" /><figcaption><em>via SharedStreets</em></figcaption></figure><p>Both cities and companies have been using a Geometric Information System(GIS) to map street level data. However, when data is merged together, the sets do not match. SharedStreets is able to link the two sets of data together by breaking down a street into short form IDs that can be referred back to in a database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*8mCoSED8zQRpftmDnOSGAA.png" /><figcaption>via SharedStreets</figcaption></figure><p>This is important because when it links up different maps’ data sets, the SharedStreets IDs provide a common reference. The grey lines represent different data sets of the same spot and the blue line represents the SharedStreet ID reference that allow a common ground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*yS1Zx9Dp15ZVv3W37HE7Ng.png" /><figcaption>via SharedStreets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*L5Y2UGPbz2FqtuyWNe76eA.png" /><figcaption>via SharedStreets</figcaption></figure><p>The millions of GPS points are clustered together and allows analysis of traffic congestion, curb usage, how long cars stay in a spot, how often vehicles are picking up and dropping. With a common map and a huge amount of data, cities now have the resources to create a roadmap for urban mobility.</p><h4>My thoughts</h4><p>This has been one of the largest collaborations with private companies and the government in what seems very much like an active attempt from all sides to do good. I hope that these companies involved have set an example as a way of providing social good with data, especially for the ones that have been emerging as abusers of our trust and privacy.</p><p>Sources:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYzcUiYMzkEE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYzcUiYMzkEE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYzcUiYMzkEE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dde4497df1268ea7057de7d47432945/href">https://medium.com/media/1dde4497df1268ea7057de7d47432945/href</a></iframe><ul><li><a href="https://nacto.org/2018/10/29/detroit-sharedstreets-nacto-pilot-new-dockless-data-standard/">The City of Detroit, SharedStreets, and NACTO to Pilot New Data Standard for Dockless Mobility - National Association of City Transportation Officials</a></li><li><a href="https://www.citylab.com/transportation/2018/02/a-powerful-map-promises-to-help-cities-keep-streets-free/553739/">To Share the Streets With Uber and Lyft, Cities Have a Powerful New Map</a></li><li><a href="https://www.wired.com/story/uber-nacto-data-sharing/">Uber Makes Peace With Cities by Spilling Its Secrets</a></li><li><a href="https://nacto.org/2018/09/26/ford-uber-lyft-share-data-through-sharedstreets-platform/">Ford, Uber &amp; Lyft agree to share data through the SharedStreets platform</a></li><li><a href="https://2018.stateofthemap.us/program/sharedstreets-making-streets-interoperable.html">State of the Map US 2018</a></li><li><a href="https://beta.observablehq.com/@kpwebb/sharedstreets-api">Getting started with SharedStreets</a></li></ul><p><a href="https://nacto.org/2018/02/22/nacto-and-otp-launch-sharedstreets/">https://nacto.org/2018/02/22/nacto-and-otp-launch-sharedstreets/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2760ad353d05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every day is filled with random events, always unpredictable.]]></title>
            <link>https://chrispfchung.medium.com/every-day-is-filled-with-random-events-always-unpredictable-19b79124356b?source=rss-46d54cf1b3ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/19b79124356b</guid>
            <category><![CDATA[random]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Chris Chung]]></dc:creator>
            <pubDate>Fri, 02 Nov 2018 05:07:39 GMT</pubDate>
            <atom:updated>2019-06-19T23:40:02.696Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“You can blow on the dice all you want, but whether they come up ‘seven’ is still a function of random luck”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxR6j82SB5JSWncfzWXaoA.png" /><figcaption>via Vyshnavi Yarlagadda</figcaption></figure><p>Random, Rndmao, Nardom. Arbitrary spellings of the same word. First I’m going to talk a little bit about the random module in python and then some ways we can use it with few lines of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*mEcnCgo-vVQ7cbmzQkU1kw.jpeg" /><figcaption>via Softonic International</figcaption></figure><p>We will be using the function shuffle(x).</p><p>First we import our random module and import its shuffle module.</p><pre>import random<br>from random import shuffle</pre><p>Then we will take our password string, reshuffle the letters and then put them back together.</p><pre>def password_scramble(string):<br> string = list(string)<br> shuffle(string)<br> print(‘’.join(string))</pre><pre><br>password_scramble(&#39;learnlovecode&#39;)</pre><pre>Output: rdloeovcneeal</pre><pre>[Finished in 0.689s]</pre><blockquote>What was the wifi code again?</blockquote><p><strong>2. Letting Python decide what you eat tonight</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*l12Y7bjPEHmtlFp-5IrFUg.jpeg" /><figcaption>via emojiisland.com</figcaption></figure><p>We will use the random.choice( ) function. It randomly chooses an element from a list.</p><p>I multiplied each element in the list by a weighted number according to my preferences. Then I let the random module choose for me.</p><pre>import random<br>types_of_rests = [‘Indian’] * 30 + [‘Italian’] * 30 + [‘Thai’] * 40<br>print(random.choice(types_of_rests))</pre><pre>Output: Indian</pre><pre>[Finished in 0.579s]</pre><p><strong>3. Choosing Mega Millions numbers </strong><em>(5 numbers between 1 &amp; 70 and 1 Megaball between 1 &amp; 25)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*J_Jwby14SfqniSk7H-ElHg.png" /><figcaption>via MegaMillions</figcaption></figure><p>We will use the <strong>random.randint(x, y)</strong> function which generates numbers between ‘x’ and ‘y’, and the <strong>.choice( ) </strong>function from before.</p><p>We want to create a new list for our generated lottery numbers. We set ‘x’ = 0 because we will be using a ‘while’ loop to keep our returned list capped. Finally creating a lucky number variable between 1 and 70.</p><pre>import random<br>lotterynumbers = []<br>megaball = range(1,26)<br>x = 0</pre><p>The randint and choice generated numbers are all compiled into the lottery numbers list.</p><pre>while x &lt; 5:<br>    lotterynumbers.append(random.randint(1, 71))<br>    x += 1</pre><pre>lotterynumbers.append(random.choice(megaball))</pre><pre>Output: [47, 58, 16, 54, 62, 13]</pre><pre>[Finished in 1.392s]</pre><h3><strong>//.</strong></h3><p>Sources:</p><p><a href="https://docs.python.org/3/library/random.html">https://docs.python.org/3/library/random.html</a></p><p><a href="https://en.wikipedia.org/wiki/Mersenne_Twister">https://en.wikipedia.org/wiki/Mersenne_Twister</a></p><ul><li><a href="https://stackoverflow.com/questions/6181304/are-there-any-ways-to-scramble-strings-in-python">Are there any ways to scramble strings in python?</a></li><li><a href="https://www.fir3net.com/Programming/Python/python-lottery-number-generator.html">Python - Lottery Number Generator</a></li><li><a href="https://stackoverflow.com/questions/14992521/python-weighted-random">Python Weighted Random</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=reddit&amp;url=https%3A//www.reddit.com/r/explainlikeimfive/comments/2i3d11/eli5_how_does_the_mersenne_twister_algorithm/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fb.thumbs.redditmedia.com%252FamUXWXfydWmcNl53gdZtOk9GSFoW5V7OJ-BMkvWedcc.png%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f56fe14b3bfb28e336cea5158d6361e/href">https://medium.com/media/6f56fe14b3bfb28e336cea5158d6361e/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=reddit&amp;url=https%3A//www.reddit.com/r/explainlikeimfive/comments/6omo5u/eli5how_does_mersenne_twister_work/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fwww.redditstatic.com%252Fnew-icon.png%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddaaceb06a9a0da23b29399bf6208cef/href">https://medium.com/media/ddaaceb06a9a0da23b29399bf6208cef/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=reddit&amp;url=https%3A//www.reddit.com/r/explainlikeimfive/comments/1k2nhu/eli5_how_do_random_number_generators_work/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fb.thumbs.redditmedia.com%252FamUXWXfydWmcNl53gdZtOk9GSFoW5V7OJ-BMkvWedcc.png%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/00ec41421d36d3e4142a1472ff41b776/href">https://medium.com/media/00ec41421d36d3e4142a1472ff41b776/href</a></iframe><ul><li><a href="https://docs.python.org/3/library/random.html">random - Generate pseudo-random numbers</a></li><li><a href="https://www.brainyquote.com/quotes/barry_ritholtz_692903?src=t_random">Barry Ritholtz Quotes</a></li><li><a href="http://www.megamillions.com/winning-numbers">Mega Millions</a></li><li><a href="https://emojiisland.com/products/thinking-face-emoji-icon">Thinking Emoji</a></li></ul><p><a href="https://password-lock-win.en.softonic.com/">https://password-lock-win.en.softonic.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19b79124356b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>