<?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 Jeff, Lu Chia-Ching on Medium]]></title>
        <description><![CDATA[Stories by Jeff, Lu Chia-Ching on Medium]]></description>
        <link>https://medium.com/@a1080211jeff?source=rss-a7ff7e0ca405------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*gOPhJPiCY2NRH9Eqa0LwVA.jpeg</url>
            <title>Stories by Jeff, Lu Chia-Ching on Medium</title>
            <link>https://medium.com/@a1080211jeff?source=rss-a7ff7e0ca405------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:23:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a1080211jeff/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[Disillusion Avalon: Board Game Data Analysis]]></title>
            <link>https://a1080211jeff.medium.com/disillusion-avalon-board-game-data-analysis-b30bb75d2cf7?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/b30bb75d2cf7</guid>
            <category><![CDATA[board-games]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Sat, 06 Mar 2021 20:03:34 GMT</pubDate>
            <atom:updated>2021-03-07T02:35:53.660Z</atom:updated>
            <content:encoded><![CDATA[<h4>How would social deduction games look like with data?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tV0D4sxulSnmblahA1-M6A.png" /></figure><h3>Introduction: Board Game!</h3><p>Avalon, or The Resistance, is an exceptionally popular board game. Players are randomly and secretly assigned a role belonging to one of two possible forces (Good or Evil in Avalon; Resistance or Spy in the original Resistance game), and should act based on their affiliation in order to win.</p><p>Although the game can sometimes be quite intricate, the underlying concept is straightforward, enabling players to learn the rules and enjoy the gameplay in just a few minutes. Since I am also fascinated by the fun of social role-playing party games, I was drawn by the question: what results can we derive from analyzing data in a board game?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*y13UY8DX7vocZKeZSfWBPQ.jpeg" /><figcaption>Source: <a href="https://gamecows.com/">https://gamecows.com/</a></figcaption></figure><p><em>Note: Since the following article assumes readers have a basic understanding of Avalon rules and tactics, if you are not familiar with Avalon, please check the </em><a href="https://en.wikipedia.org/wiki/The_Resistance_(game)"><em>Wiki</em></a><em> or this </em><a href="https://www.ultraboardgames.com/avalon/game-rules.php"><em>guide</em></a><em> for reference.</em></p><p>With that thought, I found a very neat project called <a href="https://www.proavalon.com/">ProAvalon</a>. The creator (<a href="https://www.proavalon.com/about">Victor</a>) of this open-source game has made a virtual version of Avalon that allows players around the globe to participate in a friendly setting. With Victor’s help, I was able to get ProAvalon’s log data for each game played, including some basic information and voting history. This allowed me to explore the game statistics and conduct a deeper analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HakmP-OxriDLP3LwLnRdZg.png" /><figcaption><a href="https://www.proavalon.com/">https://www.proavalon.com/</a></figcaption></figure><h3>Data Description &amp; Caveats</h3><p>The original data has over 83,000 records. To simplify the analysis, I focused on games with the most popular setting, namely games that included 5 to 6 players and only 4 special characters (‘Merlin’, ‘Percival’, ‘Assassin’, ‘Morgana’). I also filtered out games with expansion content (e.g., Lady of the Lake). After basic cleaning, the final data set for analysis contained 55,040 records and 20+ features.</p><p><em>Note: The raw data is in JSON format. If you are interested in the preprocessing in Python, please read the details of the data cleaning and the pipeline on my </em><a href="https://github.com/HiIamJeff/avalon-analysis"><em>GitHub</em></a><em>. This article leaves out all of the technical processes.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vD3syCcGyLegKi3XgcN0Tg.png" /><figcaption>The original JSON data format for a game</figcaption></figure><p>Before we jump into the analysis, I would like to mention a few caveats:</p><ol><li>The data doesn’t include any of the text messages during the games, even though conversation plays a huge role in Avalon. This might sound like a deal-breaker for analysis, but other data such as voting history and win rate are still important and may provide interesting insights. We just have to keep in mind that we are making certain observations and inferences without knowing the discussion during the gameplay.</li><li>Although the data is very detailed in terms of the voting stage, we do not know who had voted “success” or “fail” when 3 or 4 were are on a mission. However, this does not pose much concern as we can use some methods to deduce whether the spy in the mission team had actually voted “fail” or cunningly voted “success” to deceive others.</li><li>Since the game is built with an English interface and the data doesn’t contain any personal or demographic information, we can only assume that most of the players are English speakers.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FrXlK3NZjLGc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DrXlK3NZjLGc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FrXlK3NZjLGc%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/a6288aa343f5204bfb71f282fbffcf89/href">https://medium.com/media/a6288aa343f5204bfb71f282fbffcf89/href</a></iframe><h3>Basic Statistics: What does the data look like?</h3><p>Alright, enough of the introduction, let’s jump into it.</p><h4>Number of Games Played</h4><p>The data is collected from 7/2018 to 1/2021. As we can see, there is a spike in the number of games played in mid-2020, possibly suggesting that the COVID-19 pandemic had spurred an increase in gameplay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nh4t4wVjdCODh2gJqwStQQ.png" /><figcaption>The absence of data between 7/2019 and 10/2019 was due to a shutdown of the service.</figcaption></figure><h4>Game Time: Huge variation in times!</h4><p>To get a general idea of the gameplay, let’s first take a look at the most basic data, namely the time span. The average time for a single game is about 15 minutes. The time span varies greatly as the standard deviation is almost 10 minutes.</p><p>As the below graph shows, the distribution actually resembles more of a “log-normal distribution” instead of a normal distribution. Interestingly, a considerable percentage of the games (<strong>11.7%</strong>) were only played for less than 5 minutes! I suspect that many of those games were played by non-regular players, because in Avalon, approving everything without a second thought could result in a very short game. Another possible reason is that this could be the result of imbalanced match-making, since there is no ranking or match-making system used in the ProAvalon platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*Ir4TjA5l-aSO0L_cCkIrLQ.png" /><figcaption>Mean: 15.57 mins; Standard Deviation: 9.99 mins</figcaption></figure><p><em>Note: There were some exceptionally long games that lasted over an hour; they were not caused by some bugs or AFK players but rather was because the games had very active voting sessions.</em></p><h4>Major Features: Who won, and how</h4><p>Next, the most important information in games: who won. The win rates of the Good team and the Evil team are <strong>56.5%</strong> and <strong>43.5%</strong> respectively. This came as a bit of a surprise to me, since I had always thought the “good guy” would win most of the time. However, the numbers say otherwise.</p><p>To further break it down, when the Evil team won, over half of their wins (57%) were because, despite mission success for the Good team, the Assassin correctly identified Merlin. Meanwhile, missions failing 3 times accounted for about 39% of Evil team wins. Hammer rejecting (which means the assembling vote fails 5 times) only accounted for a tiny portion (about 4%).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*Pj3iidLaFG798ONBgaOiVQ.png" /><figcaption>Spy/Evil team has different win conditions</figcaption></figure><h4>Win Rate &amp; Time: Longer games, more balanced results</h4><p>Next, an important question we can ask is: <strong>what is the relationship between game time and which team wins?</strong></p><p>If we split the data into two groups based on which team wins, then we can see slightly different distributions. From this, we can make the following two observations:</p><ol><li>When the span of the game is very short, the chance of the Good team winning is higher. This could result from games ending in the third quests because only Good players get assigned to quests by chance and Evil players don’t have enough clues on Merlin.</li><li>When the game time is over 30 minutes, the gap between the number of games won by the Good team or the Evil team becomes smaller. Games that last longer could represent more competitive gameplays where it was not immediately apparent which team would win.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*lJgRhf1EcDspoJM2tAyuog.png" /><figcaption>A clear distinction between which team wins the game.</figcaption></figure><h4>Win Rate &amp; Failed Vote: Dispute results in more losses for the good team?</h4><p>Another metric we can look into is how many failed votes (the number of votes that rejected a mission team proposed by the mission leader) happened in one game. Let’s look at the standalone information about failed votes.</p><p>The histograms have some very interesting results if we split the data into two groups: games with 5 players, or those with 6. For the games with 5 players (left), many games have no failed votes, and there are some peaks at 4 and 8 failed votes. This could suggest that since reaching 5 failed votes for a single mission would immediately make the Good team lose, most players would stop disputing at the 5th consecutive votes. In the data, 4 and 8 failed votes likely meant the game experienced one or two rounds where four consecutive votes rejected a mission team, forcing the Good team to accept the team formed at the 5th vote.). Similarly, six-players games have this pattern too. There are spikes in 0, 8, 12, 16 failed votes (although not with 4). In particular, there was a huge peak for the number of games with 12 failed votes. I would speculate that this may stem from most games only stopping at rounds three or four (meaning missions have succeeded 3 times), so 12 is the magic number for very competitive games.</p><p>Based on these observations, I would also say that 6-player games appear far more competitive and favored by seasonal players than 5-players games because of fewer 0 failed votes. 6-player games might be more fun and balanced, given that there are more 6-player games played than 5-player games.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6FUjZd6NWcToTBxq0Yyfw.png" /><figcaption>The number of games with each count of failed votes for 5-player games (left) and 6-player games (right).</figcaption></figure><p>Now, how about failed votes with win rates? As shown in the graph below (y-axis represents the win rate of the Good team), we can see a trend where the Good team has a lower win rate when the number of failed votes increases.</p><p>Again, if we split the data, some numbers stand out. When the number of failed votes reaches 4 for 5-player games and reaches 8 for 6-players games, the Good team has the highest win rates. The logic behind this is not clear; perhaps the Good team in those games tried to use as many failed votes as possible when the mission leader seemed suspicious and might have been Morgana or Assassin, for example. The Good team’s win rates being highest at 4 and 8 votes for 5-player and 6-player games, respectively, could also be due to more sophisticated game tactics correlating with such results, or even perhaps could be related to ProAvalon game systems issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oD4n21VyjnVbXaYDqEVxRA.png" /><figcaption>The Good team’s win rates for 5-player games (left) and 6-player games (right), based on the number of failed votes in the game.</figcaption></figure><h3>Advanced Analysis: Win condition vs Voting and starting position</h3><p>Up until now, we have only made some fundamental observations. Because we are interested in how various factors might influence who wins, let’s next dive into the meat of the data, which is voting information. In this section, I used the <strong>winning team (which team won; i.e., Good or Evil) </strong>and <strong>win condition (how the game was won; e.g., Mission Fails, Assassination Succeeds) </strong>as target variables to see how other factors potentially affected them.</p><blockquote>Note: All of the tests below are done with Chi-squared analysis (assessing independence among categorical variables) under the 95% confidence level. Thus, a p-value of 0.05 is the threshold for the significance of the test.</blockquote><h4>First leader</h4><p>Some may believe that the choice of who acts as the first “leader” may influence the result of the game.</p><p>The leader is the person who proposes the team, assigning a few players to do the quest. And since this is the role that appears to have more power and freedom to manipulate the game, people often think this is a decisive factor for which team would ultimately win.</p><p>However, a statistical analysis tells a different story. Although the simple statistics test (chi-squared analysis) shows there is a significant relationship (p-value = 0.00) between “who is the first leader” and these two targets (“which team wins” and “how the game was won”), the effect size calculated by adjusted <a href="https://en.wikipedia.org/wiki/Cram%C3%A9r%27s_V">Cramér’s V</a> is actually pretty small (<strong>0.030</strong> for winning team &amp; <strong>0.022 </strong>for win condition). Therefore, I would actually conclude that “which character is the first leader” alone wouldn’t substantially affect the game’s result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Fbzqv0xoJv7DrSgrq-M5qw.png" /><figcaption>A chi-squared analysis on “howTheGameWasWon”</figcaption></figure><blockquote>Note 1: Chi-squared tests tend to deflate the p-value as the sample size goes over 10,000, so I incorporated the calculation of the effect size, which represents the strength of the association between two variables; Cramér’s V varies from 0 (corresponding to no association between the variables) to 1 (complete association)<br>Note 2: I also tested useing games with just 5 players or 6 players. Once the sample size goes down, the p-value goes up for the Chi-squared test (0.158 and 0.318 respectively)</blockquote><h4>The sequence of leadership</h4><p>If “who is the first leader” was not a decisive factor for the result of the game, then how about the more complicated “<strong>sequence of leadership</strong>”?</p><p>The sequence of leadership is the sequence of who proposes a team in each quest. It is reasonable to think that this ordering may be correlated to the result (for example, if Evil team members keep getting the chance to pick quest members, the Evil team could more easily sabotage the mission).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*qz9LiJkdwun3Rh6QbNDWUg.png" /><figcaption>Wow, there are 5,791 unique sequences in this dataset!</figcaption></figure><p>However, a deeper analysis suggests that it is not so straightforward. If we switch “which role starts first” with “the sequence of the leadership” in our chi-squared test, the test result shows a significant relationship (p-value with 0.00 for “which team wins”). Despite that, the effect sizes for 5-players games and 6-players games are 0.125 and 0.144 respectively, which are still rather weak values. That being said, these still reflect stronger relationships than for the previous feature, and so I would consider the leadership sequence to be a meaningful factor.</p><p>One thing worth noticing is that, even in games with the sequence of [‘Resistance’, ‘Resistance’, ‘Resistance’, ‘Resistance’, ‘Resistance’] where the leader of each quest is from the Good team (this is among the top 10 most common sequences), the Evil team still wins most of the time (60% of the games). Under this scenario, although the Good team could win at the quest stage, the Evil team has an almost fifty-fifty chance to assassinate Merlin correctly. This shows that the game is so much more than just who gets to play the leader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Es65ZRSYgRQtY4bHudK9ag.png" /><figcaption>Top 10 common sequences in leaderships with “How the game was won”</figcaption></figure><h3>More Practical: Special Characters as the first leader</h3><h4>Player’s view: What would you do if you are a special character?</h4><p>Until this point, our analysis still hasn’t quite provided very useful tips that players could use during gameplay. Especially for newcomers to strategy games like Avalon, it can sometimes be quite tough at the outset to get the hang of the game. By further analyzing the data, including choices for the first mission teams, I hoped to uncover some insights and provide a general guideline for players new to Avalon. As such, I also had this thought — <strong>what could players do to increase their win rate when they are a special character and also the first leader?</strong></p><p>Some special characters (Merlin, Percival, and Morgana/Hitman) might have some advantages while making a certain opening hand given they know something more. Thus, I decided to investigate whether the first mission leaders being special characters could possibly reveal additional insights that might be relevant for players during gameplay.</p><h4>Morgana and Assassin: Does complicated play pay off?</h4><p>In the evil team, Morgana and Assassin<strong> </strong>have the knowledge of who is in the opposite team. Let’s see the summary statistics of the choice of the first team and how that may impact the end results.</p><p>For the test with “Which team wins”, the p-value shows 0.00, rejecting the null hypothesis that two variables are independent. Yet again, the effect size shows only 0.0457, indicating a very small association. From this, we can only say that there is a slightly higher chance that the Evil team would win if an Evil team member picks two Evil members (Morgana and Assassin) as the first team members. Although this approach carries the risk that there could be two fail votes in the process (thereby giving a hint to the Good team on who Evil team affiliates are), the result is still better than picking one Evil member and one Good member. As an Evil team affiliate being the first mission leader, choosing two Good team members would generally not be worth considering (although on the other hand, this could be a cunning strategy to use, especially as the Evil still could have a good chance of winning).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*RHMSImK_ZTY1cs9WBraCmg.png" /><figcaption>If you are in the Evil team, what would you do?</figcaption></figure><h4>Merlin: What should the player who knows everything do?</h4><p>Merlin has the power of knowing who is who. But if Merlin is the mission leader in the first round, what is the best approach they could use?</p><p>Based on the statistics, the p-value once again shows 0.00, passing the significant test. Still, the effect size shows only 0.0655, a very minor effect. According to the summary table, picking two Good team members is the best option, a move that likely aligns with our intuition. <strong>The other options are unnecessary</strong> (Although some people might think that picking one Evil team member on purpose could be a clever trick to expose them).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*AunjseIbUMUdcaNrRM18-g.png" /></figure><h4>Percival: Can the player who knows half the story influence game results?</h4><p>Next, we move on to Percival, the character who knows which two players are Merlin and Morgana (but doesn’t know who’s who). I distinguished four meaningful choices Percival can make as the first mission leader creating a team: “Merlin and Morgana”, “Percival and 1 of those 2”, “Percival and others” (not including Merlin or Morgana), and “All the others” (meaning the mission team does not include Percival, Merlin, or Morgana). However, the result is not significant at all (p-value: 0.4863). Thus, it seems that by itself, what decision Percival makes is not that important to the final result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*tXq5tE4L-D6bkpqaO4eydQ.png" /><figcaption>Sadly, we can’t reject the hypothesis that Percival&#39;s choice doesn’t matter on its own.</figcaption></figure><h3>Conclusion: A fair and complicated game!</h3><p>We have spent quite some time analyzing many aspects of the data. Based on these findings, I would say that Avalon is a very smart and balanced board game; in other words, although there are certain tactics and strategies that general players can use to increase their chances of winning, ultimately there are no easy formulas that guarantee a win. I believe that if we had the discussion data, we could have explored the subject at an even deeper level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pu7qy5WzxfYrgapt" /><figcaption>Photo by <a href="https://unsplash.com/@vladsargu?utm_source=medium&amp;utm_medium=referral">Vlad Sargu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>That being said, we can still summarize a few practical findings here (tl;dr version):</p><ol><li><strong>Take more time to enjoy the game</strong>. Games with longer playtime tend to have a more balanced win rate. At least on the ProAvalon platform, once the game exceeded 20 minutes, the gap between win rates greatly decreased. Though there might be some additional factors for this result, taking more time to make a well-informed decision is always a good move.</li><li><strong>If you are on the Evil team, there’s no need to worry</strong>. If you are the “bad guy”, don’t get too nervous about it. Even if you only have one other teammate and have to sabotage under the hood, the numbers tell you that you still have a great chance of winning the game. Furthermore, even if you lose during the voting rounds, there is still a considerable chance for you to win if you assassinate Merlin. After all, over 50% of the Evil team winning occurs through this assassination. Subtly misleading discussion during voting sessions is also a good way to increase your chance to win.</li><li><strong>Don’t feel pressure to make sophisticated moves</strong>. If you are new to the game and wonder what you should do if you are the first mission leader, just make the most logical move, which is picking your allies as the quest members. We can’t say that this definitely applies to all levels of competition because of the limits of the data, but these analyses about picking first mission members do consistently show that if you want to confuse others or hide your intentions, it may be wiser to do so during discussion rather than during the choice of mission members.</li></ol><p>Overall, we have been able to uncover several interesting points and see how statistical analysis could be applied to this subject. In general, it is hard to find this kind of gaming data about board games, so I again appreciate <a href="https://www.proavalon.com/">Victor’s effort</a>s in making the online version of Avalon and offering the precious data. I would love to hear any comments and feedback on this subject.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aOcIVbL8Y3ng-mX3" /><figcaption>Photo by <a href="https://unsplash.com/@karthikb351?utm_source=medium&amp;utm_medium=referral">Karthik Balakrishnan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What’s next?</h3><p>This was a wild ride exploring various aspects of Avalon, and yet there are still many more details of Avalon’s fascinating gameplay to be explored!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*phHgw7ZaLyLHhfsfRRZQcg.png" /><figcaption>If you are also interested, please feel free to contribute to <a href="https://github.com/vck3000/ProAvalon">the project</a> as well!</figcaption></figure><p>To keep this article compact, I didn’t include all the things I could think of in this post (e.g., assassination time, failed votes in each quest, modeling)</p><p>For the next steps, I would try to use explorative Machine Learning techniques to uncover more insights from the data. I am optimistic that there are ways to model this and make it work (e.g., modeling with the Bayesian probability approach).</p><p>Thanks for reading the long post! I would like to give special thanks to <a href="https://www.linkedin.com/in/michelle-leung-01/">Michelle</a> for dedicated proofreading and suggestion. Again, if you are interested in the technical details about how to process the data and derive the analyses described above, please refer to my <a href="https://github.com/HiIamJeff/avalon-analysis">GitHub</a>! I learned a lot from this fun project, so feel free to reply with any thoughts and opinions, or contact me through <a href="https://www.linkedin.com/in/jefflu-chia-ching-lu/">Linkedin</a>!</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b30bb75d2cf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overlooking Crime in New York City amid the Pandemic and Protests]]></title>
            <link>https://medium.com/data-science/overlooking-crime-in-new-york-city-amid-the-pandemic-and-protests-d227e698182e?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/d227e698182e</guid>
            <category><![CDATA[new-york]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[crime]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Tue, 15 Sep 2020 11:21:01 GMT</pubDate>
            <atom:updated>2020-09-17T12:28:28.600Z</atom:updated>
            <content:encoded><![CDATA[<h4>What kind of story does the crime data tell about NYC in 2020 so far?</h4><h3>Introduction: What is going on with NYC?</h3><p>These days, the crime rate in New York City got very conflicting ideas. Some politicians said violent crime is rampaging in the big apple, but some others said it is safer than ever before due to the lockdown. With the upcoming election, I think this is just one of the public topics that have always been used for political interests. But I also got many versions of the story personally.</p><p>I have friends and families said it becomes inhabitable. Meanwhile, I haven’t heard anything different from my foreign friends or colleagues still in the city. This got me interested in getting back to my <a href="https://medium.com/@a1080211jeff/exploring-nyc-analysis-of-crime-data-in-new-york-city-6134642b9833">old project about NYC crime</a> almost a year old and do something different this time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KU1ACZM6Zmazguf2H5AQrg.png" /><figcaption>Conflicting information is everywhere. Source: Google</figcaption></figure><h3>The Topics</h3><p>Based on very contradicting opinions mentioned above, I can think of these two related questions:</p><ol><li><strong>Can we find the impact of COVID19 or the protest on the crime rate generally?</strong></li><li><strong>Does NYC become more violent or dangerous than before? What type of crime stands out amid 2020?</strong></li></ol><h3>The Data</h3><p>This is not an easy case given how unprecedentedly 2020 is different from previous years. To not get involved in political views or preassumption, I choose the open-sourced data to do the research. We will revisit the NYPD Complaint Data on <a href="https://data.cityofnewyork.us/Public-Safety/NYPD-Complaint-Data-Historic/qgea-i56i">NYCOpenData</a>, but this time, we will pick the data spanning the past five years (starting from 2015). To answer these topics, though, there are a huge caveat and an issue.</p><ol><li>We have to assume that the criminal record system from NYPD hasn’t experienced any disfunction during any specific event. The recording didn’t stop or change the process that could affect how the record displays itself in the dataset because of the pandemic or the protest.</li><li>Since the time this article was made is the start of November 2020, we miss the data from the other half of the year. Because of this, we extracted only the data from <strong>the first six months</strong> of each year to do the testing.</li></ol><p>p.s.1 The crime rate is well-known for changing according to the season of the year. If we plot the data from previous years along with the time, we could clearly see some identical seasonality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*22Ib8bQ9eceHz9n3DhYzNA.png" /></figure><p>p.s.2 I used Python with Pandas &amp; Matplotlib package for most of the process. I will keep minimal codes throughout the article for simplicity, but if you are interested in data processing, visualization, or some details, please feel free to <a href="https://www.linkedin.com/in/jefflu-chia-ching-lu/">contact me</a> for more information.</p><h3>Can we find the impact of COVID19 or the protest on the crime rate generally?</h3><p>Before even applying any statistics, we can spot a distinct difference from a simple graph. In the middle of the first half-year (around March), the crime data from 2020 had a big valley. And later, the crime rate slightly returns to a mild level as shown under.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Xj4EG9y2aUdvN0AjFqANg.png" /></figure><p>If we put a more detailed time frame on the axis and focus on 2020, we can spot some coincidence between the major events and the drop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SK-eDFiSidLKCX7tXnp1PA.png" /></figure><p>From the graph above, the executive order had somewhat correlated to the drop. To our surprise. the protest didn’t obviously spike the total number of crime events. (We will dig deeper and examine the crime type in the later part.)</p><h4>Statistical analysis</h4><p>Until now, we might already see the difference between these two sets, but let’s just said that we don’t consider the time factor but only the difference in the total distribution of the daily crime number. With the statistical testing (<strong>Anderson–Darling test</strong>,<strong> </strong>a statistical test of whether a given sample of data is drawn from a given probability distribution), we could see if the distributions of the past 5 years and the 2020s are the same. Under the setting (The null hypothesis is “the 2020 data are drawn from the same distribution” and the confidence level is set to 95%), we confidently rejected the hypothesis and say that 2020 data are not generated from the same distribution from a 5-years data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*UYw9rVqQL1p5cKAh1yNTzg.png" /></figure><p>Here is the plotting (Histogram &amp; Cumulative Distribution Function) showing how different between those two in a visual way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*guePSaOaw6qWr2CYhR2MBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Lwjt5GYArCN5Itg5daAbw.png" /></figure><p>p.s. Although the number of daily crime cases is the discrete value, the sampling number is big enough (the 5-year histogram is similar to a normal distribution) for Anderson–Darling test, which is usually used for continuous data.</p><p>Until this point, we already prove that the crime rate in 2020 is different from the previous 5 years. Also, we could speculate that COVID seems to affect the crime rate significantly but the protest doesn’t appear in that way. To expand a little bit on the latter part, we should proceed to the next topic and look into the crime category.</p><h3>Does NYC become more violent or dangerous than before? What type of crime stands out amid 2020?</h3><p>Here, I am going to use the same arbitrary rule to classify the crime event (please see my <a href="https://medium.com/@a1080211jeff/exploring-nyc-analysis-of-crime-data-in-new-york-city-6134642b9833">previous article</a> for more explanation). We will investigate if any type of crime spike in 2020 compared to the previous 5 years.</p><p>p.s. Again, to avoid the possible seasonality related to crime types, we will use only the first half-year of the data. Also, the 5-year data is the average of the past 5 years of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*GRjxguriMLBIhXnDKxTjbw.png" /></figure><p>As we can see from the difference between 5-year and 2020 data, we know that most types of crime events have declined in 2020. There are some noticeable increases in some types, though. Burglary, Motor vehicle theft, Arson, and Murder have some level of increase in 2020.</p><p>Let’s plot these types over time to give a closer look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnXfybFofKgsko1l8nzVMA.png" /></figure><p>We can summarize some takeaways from the plot above:</p><ol><li>Most of the crimes seem affected by the COVID19 shutdown as we see nearly identical dropdowns happened in March. However, Motor vehicle theft, Burglary, Arson, and Gambling didn’t seem influenced in March for some reason. It could be these types of crimes aren’t necessarily limited by the close-down.</li><li>In general, after the huge dumps in March, most of the crime events rebound at some level, but they are still lower than the numbers at the start of the year. We might speculate that the crime events are correlated to the level of economic activities in a way, especially for non-violent crimes (e.g., Social commercial related crime, Larceny, Fraud)</li><li>During the second half of these distributions (about May), we can see some big spikes of the incidents. Specific violent crimes (such as Criminal mischief property, Arson, Aggravated assault, Burglary) has surpassed the regular level of the past 5 years. We could possibly attribute this to the series protests starting May 29th. Burglary and Arson reached a record-breaking high level as this is not something that happened frequently under normal circumstances.</li><li>The protest did spark specific types of crime events and it is disastrous to the city. That being said, the majority of crime events is still less than the 5-year average, and some specific ones (Burglary and Arson) that media extensively reported only went up in one week. Aggravated assault and Motor vehicle theft could be new problems as we see some trends, but <strong>the available data here</strong> <strong>doesn’t fully support the saying that New York City has became more violent these days in my honest opinion</strong>.</li></ol><blockquote>One thing worth pointing out is that the real number of Murder cases is way smaller than others (e.g., the scale is 100s). Thus the percentage would appear more intimidating accordingly with slight fluctuation. However, this is not downplaying distressing events! For crimes like murders and shooting, the perception and the cause of those are far more important than just the figure. This requires more detailed data to identify the underlying cause (e.g., street gangs, individual incidents). The limitation of this probing stop us from getting more concrete insight in this matter.</blockquote><h3>Conclusion: Hard to say anything till this point</h3><p>It is not an easy task to draw insight or conclusion from the complicated data this year, given that multiple unprecedented things happened at once and closely (New York City’s last curfew was in 1945!). Still, it is interesting, or somewhat responsible, to look at the real data and try to picture a true overview of the subject.</p><p>To close up the study, I can only recklessly conclude that <strong>NYC has lower crime activities because of the pandemic, even it experienced a spike from “aggressive protests” in one to two weeks.</strong> It is easy to jump to the conclusion that New York City is a cesspool of crime right now, but comparing to the past, the city doesn’t do too bad at least for the first half-year. It is crucial to keep tracking the data and see if there is a systematic change in general crime numbers if we like to reach any solid conclusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IJJZoMI8dBlsxjlx" /><figcaption>Photo by <a href="https://unsplash.com/@lucabravo?utm_source=medium&amp;utm_medium=referral">Luca Bravo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What’s next?</h3><p>After passing 2020 (hopefully, we can make it 😀), I will revisit the subject again and see if there is something more interesting to investigate. There would also be a more impactful event, the US election in November, coming along the way, and it would be another great opportunity to spot how the political activities could affect the crime rate in a city.</p><p>Thanks for reading the long post! Feel free to reply with any thoughts and opinions, or contact me through <a href="https://www.linkedin.com/in/jefflu-chia-ching-lu/">Linkedin</a>!</p><p>p.s. If you are interested in some COVID-19 state-wise info, be sure to visit this neat personal <a href="https://coronavirus-in-us.herokuapp.com/">dashboard</a> to track the curves.</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d227e698182e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/overlooking-crime-in-new-york-city-amid-the-pandemic-and-protests-d227e698182e">Overlooking Crime in New York City amid the Pandemic and Protests</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[Cross-column-based Data Manipulation in Python]]></title>
            <link>https://medium.com/data-science/cross-column-based-data-manipulation-in-python-dfa5d8ffdd64?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfa5d8ffdd64</guid>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 13:26:35 GMT</pubDate>
            <atom:updated>2020-08-19T14:23:51.762Z</atom:updated>
            <content:encoded><![CDATA[<h4>Cleaning and feature engineering data based on multiple columns in both single commands and ETL processes</h4><p>Let’s suppose your manager gives you a random dataset and told you to do a “basic” cleaning: “Keep only the records that have values in column A, B, and C or the records don’t have any value in those three columns at all“. How would you approach that?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T6qzFizyH3PtotQE" /><figcaption>Photo by <a href="https://unsplash.com/@thisisengineering?utm_source=medium&amp;utm_medium=referral">ThisisEngineering RAEng</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Feature engineering can be really basic such as scaling and encoding, but sometimes mysterious. Recently, I came across this type of cross-column-based requirement and this got me thinking, <strong>how could a cleaning logics sound so simple in words but be inherently complicated in the data cleaning and feature engineering?</strong></p><h4>Straightforward in words, not so intuitive in codes</h4><p>Most of the data manipulation skills we learned from existing courses focus on row-wise applications. This type of function is well written in data analysis packages such as Pandas, meaning analysts or data scientists don’t have to create a new application from scratch. However, things are not that easy when it comes to column-wise applications, <strong>especially involving multiple columns</strong>. If we like to perform the simple request as I mentioned in the introduction, we have to mix something more advanced such as logical relationship into the process.</p><p>In this post, I will demonstrate a basic use case and a more complicated situation about cross-column manipulation. I will also include the complete manipulation function, showcasing how to apply those functions in a regular ETL process. The techniques shared in the following article includes:</p><ol><li><strong>Computing cross-column aggregated metrics for numerical values</strong></li><li><strong>Validating records with cross-column logical operations</strong></li></ol><h3>Introducing the Dataset</h3><p>During the last spring, my friend and I have competed in Datathon 2020 hosted by Brown University. The topic is predicting where are the prospective homebuyers based on credit-bureau data and demographic data at the zip code level. The features include metrics such as bank card limit, number of open bank cards, and balance for the most recent mortgage.</p><p>The provided datasets cover April to September 2019 and the CSV files are split accordingly. There are over 36,000,000 rows and over 300 columns in sum, and the total size of those makes up about 10GB. I would use this to demonstrate the ideas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*3EYGE8NEMtSU0ewlGX1noA.png" /><figcaption>A snippet of the data set</figcaption></figure><h3>Problem 1: Reducing the cross-dataset aggregated metrics with aggregation method</h3><p>Simply put, the data is a mess. After combing data sets across different times, the total size of the data could freeze a regular laptop whenever a simple computation is applied. Thus, I wanted to come up with a way that generalized the same metric for different months (e.g., there is a “number of open bank cards” metric for each month. I like to reduce the total number of features but keep that information).</p><p>Various machine learning techniques (e.g., PCA, clustering) could achieve similar effects. However, I would transform features with the most direct fashion, which is averaging.</p><h3>Solution 1: Utilizing Pandas built-in calculation cautiously</h3><p>That’s just saying that we need to average the metrics over time. We can easily achieve that with pd.DataFrame.mean(). Pandas package also provides various aggregated function such as sum(), std().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*TLwwaD31I2wheq7IX8vCMQ.png" /><figcaption>The expected result</figcaption></figure><p>This is a relatively easy task. However, the trick is setting the correct pipeline that organizes new columns and builds up a new data frame. Here are a few tips worth mentioning:</p><ul><li>pd.DataFrame()doesn’t allow you to individually specify data type to columns accordingly as pd.read_csv()does (It is weird, I know). To accommodate the limitations, it is recommended to assignastype()functions after building a new data frame.</li><li>Also, if you had different types of numerical data to be assigned at the same time, watch out for the possible loss of information while using lists of value to build apd.DataFrame() . Auto-conversion between integer and floating-point will mangle the value without any warning! (Not to mention that numeric data converted to string value will also lose a few digits in the process)</li></ul><p>The whole function is shown below. Note that “df” is the data to be processed, and “df_col” is just for building a list of column names.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e4b671b6e95f4b77860f6d43783d676/href">https://medium.com/media/5e4b671b6e95f4b77860f6d43783d676/href</a></iframe><h3>Problem 2: Cleaning data with cross-column logical relation</h3><p>Until this point, it was no too much trouble. But here comes the tough one. Although we narrowed down the data, something was off.</p><p>In common sense, If one record (an area) has one mortgage, then there should be a value in each of the columns (average loan amount, average balance, the proportion) describing the first mortgage. If one record has no mortgage at all, then there should be no value in these three columns at all (since no mortgage in that area). However, I found out the discrepancy just by eyeballing a few rows. Some rows have the average loan amount but no average balance, and some rows only have the proportion of the second loan without the other two counterparts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*H_wGnRF0QdlNZ0wqLPcTlA.png" /><figcaption>Description of three coexisting columns</figcaption></figure><p>This type of error can seriously damage the model if it couldn’t identify the correct patterns with high-dimensional data. To make the model or the analysis more robust, the questionable records should be excluded from the data set.</p><h4>Thinking with the Venn diagram</h4><p>To understand the problem, the Venn Diagram could be helpful for understanding. For what I tried to do here, and most of the general similar ad-hoc situation, I am looking at subsetting completely-non-intersecting part and the totally-intersecting part, which is 000 (All - (A∪B∪C)) and 111 (A⋂B⋂C) respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*ICO-7xmvsJGk4Z29dR09WA.png" /><figcaption>Source: <a href="https://en.wikipedia.org/wiki/Venn_diagram">https://en.wikipedia.org/wiki/Venn_diagram</a></figcaption></figure><p>With the idea, because Pandas supports logical operators (&amp;, |, ~) I could configure the logic like this:</p><pre>## 111<br>((df[col_1].astype(bool) &amp; df[col_2].astype(bool) &amp; df[col_3].astype(bool))</pre><pre>## 000<br>(~df[col_1].astype(bool) &amp; ~df[col_2].astype(bool) &amp; ~df[col_3].astype(bool)))</pre><blockquote>p.s. In case you are wondering, no, this is not the case that you need to convert AND into OR when you do the negative logical condition (since the elements here are all binary, True or False). See this <a href="https://stackoverflow.com/a/52786447/12170001">thread</a> for another example.</blockquote><p>Then I integrated those logical operators into one line and make a series:</p><pre>## 111 or 000<br>s_bool = ((df[col_1].astype(bool) &amp; df[col_2].astype(bool) &amp; df[col_3].astype(bool))|(~df[col_1].astype(bool) &amp; ~df[col_2].astype(bool) &amp; ~df[col_3].astype(bool)))</pre><p>After concatenating all the series of boolean into one data frame, I used all() with apply() and lambda to create a short function while applying it along the columns axis. To be more specific, all(x) will do another logical operation to make sure all the different sections (groups of columns; e.g., a group of columns for 3rd loan in June, a group of columns for 5th mortgage in August) in one row obeys the rule I set in the first place (which is 111 or 000 relationship in the Venn Diagram). This came down to a final series of booleans:</p><pre>s_agg_bool = df_bool.apply(lambda x: all(x), axis = &#39;columns&#39;)<br># We can then use this series of booleans to subset the right records out of the raw data.</pre><p>Here is a final ETL function that I put the dataset through the cleaning process. Note that it was designed to apply to multiple groups of columns such as metrics from different months or from different categories:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/777100d599c87a2e54b36ae18930727a/href">https://medium.com/media/777100d599c87a2e54b36ae18930727a/href</a></iframe><blockquote>p.s. Before doing the logical works, we have to convert all NaN value into 0 and all numerical values into boolean data type, so that we can utilize the mechanic of the Pandas logic (all zero value will be False and any non-zero will be True).</blockquote><h3>Conclusion</h3><p>I quickly ran through a few tips and examples of crossed-column-based data manipulation. However, I know this is hardly a thorough guide for similar use cases.</p><p>Data manipulation is surprisingly difficult because we often face dynamic problems that a single function to impute missing values or identify biased data is far from enough in real-world scenarios. After trying to find related resources, I realized there is no systematic guide or discussion thoroughly covering the practical stuff since the essence of it is rather hard to be classified and non-traditional. Therefore, this serves as an attempt to share possible solutions, and I hope this post could spark new ideas and discover more non-ordinary methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3RmHmZua5w1sXr4R" /><figcaption>Photo by <a href="https://unsplash.com/@cristian1?utm_source=medium&amp;utm_medium=referral">Cristian Escobar</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Congrats and thanks for your reading! Feel free to reply with any thoughts and opinions, or just drop a message on my <a href="https://www.linkedin.com/in/jefflu-chia-ching-lu/">Linkedin page</a>!</p><p>p.s. If you are interested in some COVID-19 state-wise info, be sure to visit this neat personal <a href="https://coronavirus-in-us.herokuapp.com/">dashboard</a> to track the curves.</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfa5d8ffdd64" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/cross-column-based-data-manipulation-in-python-dfa5d8ffdd64">Cross-column-based Data Manipulation in Python</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[Spot the Curve: Visualization of Cases Data on Coronavirus]]></title>
            <link>https://medium.com/data-science/spot-the-curve-visualization-of-cases-data-on-coronavirus-8ec7cc1968d1?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ec7cc1968d1</guid>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 23:57:43 GMT</pubDate>
            <atom:updated>2020-06-05T09:15:25.791Z</atom:updated>
            <content:encoded><![CDATA[<h4>An attempt to investigate the “curve” through visualization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*goX3GcZOGSIqD24a" /><figcaption>Photo by <a href="https://unsplash.com/@onefabian?utm_source=medium&amp;utm_medium=referral">Fabian Quintero</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>[2020/6/4 Update | I have built a web app about tracking the latest numbers with Dash and Plotly. I will write up another article but please feel free to try it now. <a href="https://spot-the-curve-coronavirus.herokuapp.com/">https://spot-the-curve-coronavirus.herokuapp.com/</a>]</p><p>At the time of the writing (26th March 2020), Coronavirus (COVID-19) has wreaked havoc on our society. Though there was already some news about a new kind of virus spotted in Wuhan, China at the end of 2019, The outbreak in western countries just started. During the self-quarantine, it came to my mind that it would be interesting and possibly inspiring if we use the data to compare each country regarding the epidemic, <strong>instead of being bombarded with random information and number by mainstream media</strong>. As a result, I took the time of my spring break to get into this small project.</p><p><strong><em>Note from the editors:</em></strong><em> </em><a href="http://towardsdatascience.com/"><em>Towards Data Science</em></a><em> is a Medium publication primarily based on the study of data science and machine learning. We are not health professionals or epidemiologists, and the opinions of this article should not be interpreted as professional advice. To learn more about the coronavirus pandemic, you can click </em><a href="https://www.who.int/emergencies/diseases/novel-coronavirus-2019/situation-reports"><em>here</em></a><em>.</em></p><h3>Plotting Idea: “Flattening the Curve”</h3><p>When I was thinking of visualizing the condition of each country, the first thing that came to my mind is “the curve.” About the start of the March, social networks and media all suddenly filled with the idea of “Flattening the Curve.” The concept promotes the recognition of the virus for the general public, and it works like a charm in western societies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*rfrK6r14ZXp_jOtALhVOvw.png" /><figcaption><a href="https://www.vox.com/2020/3/10/21171481/coronavirus-us-cases-quarantine-cancellation">https://www.vox.com/2020/3/10/21171481/coronavirus-us-cases-quarantine-cancellation</a></figcaption></figure><p>In this popular and excellent <a href="https://medium.com/@tomaspueyo/coronavirus-act-today-or-people-will-die-f4d3d9cd99ca">medium post (by Tomas Pueyo)</a>, the author explained it pretty well. In general, the curve means the distribution of active patients that the society needs to take care of. The logic behind the graph is that we shouldn’t expect to stop all the spread, but to delay and let the nation has the capacity to resolve the cases.</p><blockquote>So our goal is not to eliminate coronavirus contagions. It’s to postpone them. — Tomas Pueyo</blockquote><p>Accordingly, I decided to create plots based on this concept, <strong>showing the growth of confirmed cases in each country with little variations.</strong></p><h4>Data Used</h4><p>At the time of writing this article, one of the most referencing data sources is <a href="https://github.com/CSSEGISandData/COVID-19">John Hopkins University</a>. It gathers data from WHO and CDC in different countries, and some of the open-sourced developers also build APIs on top of it. So I chose to use its datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0qSkhw1PiYpIIKPtD8Pug.png" /><figcaption><a href="https://github.com/CSSEGISandData/COVID-19">https://github.com/CSSEGISandData/COVID-19</a></figcaption></figure><h4>Detail of the Pre-processing &amp; Plotting</h4><p>I first found the confirmed case data of each country to do the data cleaning, making sure the data is in the time-series format. Then I used the Python visualization package (Matplotlib) to make the graph.</p><blockquote>Here is a little disclaimer: Since the data is in a very incohesive and under-developing condition, I have made compromises and personal decisions at a granular level to make this possible. If you are interested in the details of ETL, please see the <a href="https://github.com/HiIamJeff/COVID19_Spot_the_Curve">GitHub</a> page or just leave the message to me if I haven’t mentioned anything. This is a project of reporting and EDA without any prediction model.</blockquote><h3>Exploration with Confirmed Cases</h3><h4>Finding the Curve</h4><p>First of all, to get the first baseline graph, let’s just plot the confirmed cases in China, the first happening place, and in other Asian countries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvYkvvAq9Kl_vvkXV_2iHA.png" /></figure><p>However, I noticed something tricky right away. First of all, the dataset only records the case data starting from 22nd January. This makes it impossible to see the complete trend of the spread (China had its first cases way back in 2019; The earliest record in the data is 548 confirmed cases). Secondly, the data is the cumulative ones, which means that it suppose to only go up. So it is hard to get a sense of the current epidemic status (How fast the spread is) of the country.</p><h4>Improved Version: Factoring Population &amp; Tweaking Viz Elements</h4><p>To deal with the representativeness issue, I decided to overhaul the data. First, I converted the value of cumulative cases into the “daily increase” fashion. In terms of identifying the loading of a country, I consider the total number of cases an inaccurate metric, given that different levels of the population might influence countries’ capacity of public health (e.g. nurse-patient ratios).</p><blockquote>About the population, I acknowledged that the speed of spread, in most cases, is not correlated with the level of population (It should be the population density). So the main point here is to compare the capacity of dealing confirmed cases, not the “growth” of COVID-19 in each country.</blockquote><p>Accordingly, I converted it into a new one called <strong>“Infection Rate,” the number of confirmed cases per 1 million people</strong> (by the population of the country; <a href="https://www.worldometers.info/world-population/population-by-country/">Source data</a> ), to have a fair comparison with different kinds of countries. Additionally, on the plot, I aggregated the number of daily increased cases into a 2-day format and included records only after the 1st case to smooth the trend (also to have a fair start for each country). With the change, the visualization would also be more apparent since it gets messy when the numbers are big and have too many comparables.</p><pre>## Sample code for factoring population <br>def data_process_avg(complete_df):<br>    for c in list(complete_df.columns):<br>        complete_df[c] = round(complete_df[c]/country_pop_dict.get(c)*1000000, 3)<br>    return complete_df<br>#country_pop_dict is the dictionary with country names and the  #accroding populations made by other data<br>#The source codes and data are included in the GitHub.</pre><p>And then I pick other Asian countries since they are also the first few countries that got affected and have possibly “flattened the curve” in these days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PutIAM5kaqiy1n6A2-5UUg.png" /></figure><p>From the plot above, we could tell that most of the Asian countries are rather steady regarding the Coronavirus spread. South Korea once had a major infection cluster before, but it has stopped the exponential growth successfully after the incident. <strong>It is interesting that we could spot a few “curve” already on the graph, but that doesn’t mean they won’t suffer from any outbreak in the future.</strong> From the plot below (removed South Korea for better viewing), Singapore and Taiwan, which have been praised for appropriately dealing with the epidemic, are still facing potential growth in spread lately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQGz5j4qR57WaO6-rBCbQw.png" /></figure><blockquote>p.s. India wasn’t included in this chart yet because it just started to have more data on the confirmed case and it has a vastly different population-level from others. I would study it later and separately.</blockquote><p>Hypothetically speaking, strict travel bans and mandatory quarantine can mitigate the spread of the virus. Most of the countries (especially in Asia) have already issued related policies. Nevertheless, because of the 2-week incubation period and the returned citizens from aboard, we should expect that the effect takes another week or two to happen (To Be Updated).</p><h4>What is the status of the highly-spread countries now?</h4><p>After the first exploration of Asia, we knew that most of the Asian countries have a more mild spread for now. Next, I pivoted to visualizing what is going on with some of the more serious countries now.</p><p>To identify the most severely-spread countries, I kept using the same metric (infection rate) and ranked the top 10 countries with the latest infection rate (23rd March).</p><blockquote>I kept the same setting in terms of plotting, but I included records only after the 100th case to smooth the trend (Some countries had peak values due to the irregular testing routine, and some also started actively testing potential cases late.)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9el7gnJocEuuMzbsofHkIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*EYLbt5ArQuE7x1vRAj1pvg.png" /><figcaption>Rank made by 25th March</figcaption></figure><p>As it turned out that all 10 countries in the most serious situation are from Europe (only Iran from the Middle East). Surprisingly, <strong>Switzerland</strong> actually is in a dire situation among other nations (The exceeding growth rate made it surpass Italy in these two days.). In contrast, although the United States has received lots of attention from the media, it is currently at the 15th place in this standard. Despite that, it is still in its earlier stage of virus spread compared to the European countries, so we should expect more change from it (See the graph below).</p><p><em>Updated on 3/27/2020: the US is now experiencing a high </em>volume <em>of testing practice so the rank might considerably change in the future.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ssJdsInH8YvIL-dlFc5fEw.png" /></figure><h3>Future Steps: Testing Data and Dashboard</h3><p>Although we have factored in the population, currently the number of confirmed cases still heavily associated with the amount of the testing. Ideally, we would like to have as much detail about COVID-19 tests in each country as possible. However, there is not yet an official database about this.</p><blockquote>p.s. <a href="https://ourworldindata.org/coronavirus-testing-source-data">Our World in Data</a> (a group of researchers from the University of Oxford) has gathered a provisional and incomplete version of this information and makes it possible to use this in the visualization (Please see one of their charts below).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*LVd1uNgqrNEs1_fL9lP9AA.png" /><figcaption>Testing data with cases data</figcaption></figure><p>In the future, I will keep adding new stuff based on the work here and build an interactive and self-controllable dashboard on a web app to generate any of these charts for comparison.</p><h3>Conclusion: So Much Work to be Done</h3><p>In this article, we used a more considerate approach to examine the current status of Coronavirus in specific countries. We spot a few potential curves along the way and recognize the seriousness of COVID-19 in some countries. Yet, the information also showed that we should beware of any significant change in terms of the spread and also the data.</p><p>Though the content seems little, it was actually a lot of work for a novice to epidemiology and public health like me to analyze and make assumptions on this matter. Besides domain knowledge, the open data of COVID-19 is considerably underdeveloped at this point. The more I look into the data, even from highly-referred sources, the more frustrated I am because the most reliable and credible information, for now, is only the confirmed cases (e.g. JHU’s GitHub has some annoying inconsistency in the data; Multiple APIs keep going on and off from time to time).</p><p>That being said, there is still a group of professionals keeping on making the data complete and actually distill actionable insights. If anyone interested in doing a project on this, you could check out some useful articles and interesting <a href="https://www.reddit.com/r/datascience/comments/fm17ja/to_all_data_scientists_out_there_crowdsourcing/?utm_source=share&amp;utm_medium=web2x">discussions</a>.</p><ul><li><a href="https://medium.com/nightingale/ten-considerations-before-you-create-another-chart-about-covid-19-27d3bd691be8">Ten Considerations Before you Create another Chart about COVID-19</a></li><li><a href="https://medium.com/@joschabach/flattening-the-curve-is-a-deadly-delusion-eea324fe9727">Don’t “Flatten the Curve,” stop it!</a></li></ul><blockquote>For now, let’s give it more time and doing our part!</blockquote><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/WhitePeopleTwitter/comments/fnc9qv/not_all_heroes_wear_capes/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fpreview.redd.it%252Flf2ud0ty1co41.jpg%253Fauto%253Dwebp%2526s%253D7f19c2c7ca28d30d0d99fcc2085119667687de61%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/591dcba24b11c6f838247b8108e8b3f8/href">https://medium.com/media/591dcba24b11c6f838247b8108e8b3f8/href</a></iframe><p>Congrats and Thanks for your reading! Feel free to check up my <a href="https://github.com/HiIamJeff/COVID19_Spot_the_Curve">Github</a> for the full codes and drop a message at cl3883@columbia.edu</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ec7cc1968d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/spot-the-curve-visualization-of-cases-data-on-coronavirus-8ec7cc1968d1">Spot the Curve: Visualization of Cases Data on Coronavirus</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[Python 線上課程心得-Applied Data Science with Python by UMN]]></title>
            <link>https://a1080211jeff.medium.com/python-%E7%B7%9A%E4%B8%8A%E8%AA%B2%E7%A8%8B%E5%BF%83%E5%BE%97-applied-data-science-with-python-by-umn-8fbd04361d4?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fbd04361d4</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[coursera]]></category>
            <category><![CDATA[online-courses]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Tue, 24 Dec 2019 11:01:02 GMT</pubDate>
            <atom:updated>2019-12-24T12:08:47.646Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Review for Python/DS Online Courses in Mandarin</h4><p>2018年底，我上完了入門的 Python for Everybody 系列課程 (<a href="https://link.medium.com/gyksNFUjB2">推薦心得</a>)，對 Python 有一些了解。在那時間點、我的碩士申請也已經告一段落，因此這時的學習目標轉變了一點。因為我不需要再充實我的履歷內容，所以當時不再強調快速有效率，而是要「增加 coding 能力與實際操作 Data Science 的經驗」。 也因為上一次在 Coursera 的 Python 課有不錯的經驗，我就直接選擇了同所學校 UNM 的下一個系列，我接著繼續上 Cousera 上 UMN 的下一個系列 <a href="https://www.coursera.org/specializations/data-science-python">Applied Data Science with Python Specialization</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QddaOFoI2HgTL7KD6Egw6g.png" /></figure><h3>本文適合對象</h3><p>這篇與上一篇介紹課程心得的文章稍微不同，會不提線上課程的選擇，而會較專注在課程本身的內容 (難度、課程內容、上課心得…)，希望對這個線上課程也有興趣的人能夠在投入時間和心力 (和一點點學費 :)) 之前 ，先瞭解這課程的優缺點和一些加速學習、上課的技巧。</p><h3>課程介紹</h3><p>Applied Data Science with Python Specialization 雖然跟 Python for Everyone Specialization 一樣是同個學校、科系開的系列，但剛開始就會發現這堂進階課有很多不同之處：</p><h4>1. 授課老師</h4><p>這堂課的老師不再是知名的 Chuck，而是由另一個叫 Christopher 與其他講師助教組成。基本上老師的品質一樣有一定水準，但單純對英文為第二語言的人來說會稍難聽懂 (尤其中間有個印度裔老師在講 Text Mining 的章節)，整體授課感覺 Chuck 比較清楚明瞭也更有活力，這堂課就比較像是上一般的線上課程。</p><h4>2. 上課工具</h4><p>這系列會開始使用一個非常方便、適合做資料專案的 Python 工具 — Jupyter Notebook/iPython。簡單來說 Jupyter Notebook 是一個能分段執行程式且很好閱讀理解的 Python 介面，這對實際執行 code 或作上課學習作筆記非常直覺 (我自己使用這套工具後就沒再用一般的編輯器像 Atom)。網路上許多教學教材或資料分析專案都是用這個製作，熟悉 Notebook 對之後要自己做 project 或學習別人的專案很有用 (尤其 Kaggle)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQOhUiaPjWloC8FBCrbsEQ.png" /><figcaption>Jupyter Notebook 除了 code 還能編輯好懂得 description</figcaption></figure><h4>3. 內容難度</h4><p>這系列內容有明顯比上一堂多很多，方向也更加確定，就是 Data Science 的各種操作。大綱包含 Supervised Machine Learning、進階的 Visualization (Matplotlib)、Text Mining、Network Analysis，難度也是直線上升。但這邊的難度並非因為有演算法或微積分 (操作都是套用 package 就好)，而是這次的作業都比較接近實作，包含許多 Data Cleaning &amp; Manipulation，所以先前 Python 的經驗就很重要。不過第一堂課 Introduction to Data Science in Python 的內容大部分是複習所有之後會用到的 Data Cleaning 函數、技巧，所以即使沒有太多 coding 經驗，也不至於完全卡關。</p><h3>上課技巧 &amp; 心得建議</h3><p>綜觀上述，這系列要投入的時間成本比上一個系列多很多 (我一天花的時間多到覺得這好像不是可以一邊工作一邊上課的課程…)，除了英文字彙變多、課程難理解、作業變很開放複雜外，另一個點就是這堂課的設計本身有點問題，而且是硬體上面，不太能障礙排除的。所以這邊要分享大方向建議和當初上課時碰到的特定問題和解法。</p><h4>上課時一定要…</h4><p><strong>1. 碰到問題第一步先找 Discussion Forums</strong>: 雖然 Google 找答案是非常重要的技能，但這個課程意外多的是只有這邊學生才會碰到的東西，所以建議不論碰到哪種問題 (Jupyter Notebook 打不開、資料讀不好、看不懂題目、作業怎麼交都0分…) 一定要先找課程的 Discussion Forum。除了置頂的 thread，也可以多用搜尋功能找關鍵字 (e.g. 作業的第二題有問題就直接搜尋 “Question 2”)。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hWJu2KIVDMCMz3Tr1EWdiw.png" /><figcaption>這個系列會花很多時間泡在這邊…</figcaption></figure><p><strong>2. 用 local 端 Notebook 操作</strong>: 雖然 Notebook 很好用，但我對 Coursera 的 Notebook 蠻失望的。除了軟體版本 (至少在我上課的時間點是) 與當下的版本不同，編輯或跑執行的時候都有明顯感受到的卡頓和緩慢。所以建議是直接把 Notebook 弄到自己電腦後再編輯，最後需要交作業再把 code 複製上去 (萬一這時碰到版本問題再去 Forum 找答案)。除了Notebook 本身之外，Coursera 的雲端也有上課的教材、資料集可以下載， 這對自己做課堂筆記也比較方便。</p><h4>某些特定主題或作業…</h4><p>1. <strong>Visualization 多查 Forum</strong>: 在這系列的第二堂課 Applied Plotting, Charting &amp; Data Representation in Python 會開始學到 Python 的 製圖 package Matplotlib。如果是學過 R 的 ggplot2 的人，剛開始學 Matplotlib 會覺得邏輯超級不順，尤其我覺得 Matplotlib 在網路上的教學資源比較混亂 (Pandas 的官方文件寫的有調理也很完整，Matplotlib 文件相對的很雜亂，會需要從各種 Stack Overflow 去拼湊東西)，寫作業時會很麻煩。所以我會建議直接查 Forum 找最簡單直接的做法，尤其有個作業是做出一個特定的圖時，看外面的資訊可能會自己變得很複雜 (真的對 Matplotlib 有興趣可以等完成這堂課後再去依實際用途學，尤其現在的的語言或套裝軟體多到不一定要用 Python 做)。</p><p><strong>2. 學 Text Mining 要保持理智</strong>: 雖然可能誇張了，但我記得學到第四堂課 Applied Text Mining in Python 時超級崩潰，讓我對這系列的評價掉了很多哈哈。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0MynMFRpXfS1nXHq0c8Ag.png" /><figcaption>許多學生對這堂課很有看法</figcaption></figure><p>第一點是 Text Mining 真的有點麻煩，除了要先懂 Corpus 的概念，還要開始用很多 Regular Expression。RE 除了很不直覺，細節多到我要自己弄很長的筆記紀錄 (去查 Stack Overflow 會發現同樣目標可以有3種 regex 寫法)。這邊建議可以搭配一個好用網站學習 ( <a href="https://regexr.com/">https://regexr.com/</a>)，上面可以快速幫你實驗寫的 expression 也可以自己打想抓的文字測試，會比在 Notebook 上測試快很多。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0MFgLFCuomqgxDVFZ56vw.png" /><figcaption><a href="https://regexr.com/">regexr.com</a></figcaption></figure><p>第二點也最失望的一點，就是這堂課的某些作業幾乎是無法正常完成。除了平台的自動評分機制很難理解，某幾題的問題敘述是直接寫錯，學生都在討論區哀號了但看起來這課程在一開始寫好後都沒修正過。最後我是在網路上找答案拼湊出來過關，但上到這邊我認真覺得心很累快撐不下去，所以建議大家如果這堂課碰到問題不要硬幹，直接看討論區不然上 Github 找解法 (或是敲我看怎麼幫忙哈…)。</p><p><strong>3. 類別變數的 Encoding 選擇: </strong>在第二堂課 Applied Machine Learning in Python 中會碰到許多實做 Machine Learning 的作業，這堂課基本上沒什麼問題，就是沒特別著墨類別變數的資料處理方式，所以碰到類別變數的時候會需要自己去找方法處理 (p.s. Python 大部分的 ML package 都不會自己做 dummy variable 而需要自己操作，這點跟 R 原生函數差很多)。重點來了，通常這時候你會查到很多 Label Encoder 和 One Hot Encoder 的資訊，但這些操作或文章對剛入門的人也許會有點複雜 (而且方法也在改變)，所以我建議直接用 Pandas 套件的 get_dummies() 處理就好 (這個函數會直接把特定 column 轉成 dummy variables)，可以省去很多花費在這個議題的時間。</p><blockquote>P.S. 如果真的想了解其他 encoder 的做法，可以參考一個新的 package 叫 <a href="https://towardsdatascience.com/columntransformer-in-scikit-for-labelencoding-and-onehotencoding-in-machine-learning-c6255952731b">ColumnTransformer</a> (但這個課程的 Notebook 可能不支援新的作法，所以我才會建議可以直接跳過學習 Label Encoder 或 One Hot Encoder，等自己有興趣再去找資源花時間學)</blockquote><h3>總結</h3><p>總體來說，這堂課非常適合當作入門 Machine Learning 和想精進 Python 操作的人。雖然前面數落了很多缺點，他還是提供了非常不錯的內容，尤其是講機器學習的地方，理論不會太深也有很多實際操作的機會，我覺得是難易適中、深入淺出的體驗，也是我最沒有怨言的部分。我也很喜歡這堂課的作業部分，提供很多自己發揮 data cleaning 的機會，尤其 Text Mining 的部分實用且難度頗高。</p><p>Applied Data Science with Python Specialization 算是我自己線上課程的一個終點。完成這系列後，我開始自己去找不同的資料玩、去嘗試 Kaggle 和 open-source data (e.g. <a href="https://medium.com/@a1080211jeff/exploring-nyc-analysis-of-crime-data-in-new-york-city-6134642b9833">紐約市犯罪資料分析</a>)，希望大家一樣也能藉由 Python for Everything 和 Applied Data Science with Python Specialization 這兩個系列快速入門 Business Analytics 和 Data Science 的領域！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8eBC1OcjXSGNWwxj" /><figcaption>Photo by <a href="https://unsplash.com/@bradbarmore?utm_source=medium&amp;utm_medium=referral">Brad Barmore</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>若有任何想法或回饋，歡迎留言或直接敲我 Linkedin 囉！ Congrats and Thanks for reading through all of it. Feel free to press clap as many as you want : )</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fbd04361d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring NYC - Analysis of Crime Data in New York City]]></title>
            <link>https://a1080211jeff.medium.com/exploring-nyc-analysis-of-crime-data-in-new-york-city-6134642b9833?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/6134642b9833</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nyc]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[crime]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Thu, 07 Nov 2019 16:01:13 GMT</pubDate>
            <atom:updated>2019-11-10T04:14:52.504Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using NYPD Complaint Data to analyze crime events in different boroughs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6IYN5lIeBdjQNaXQ" /><figcaption>Photo by <a href="https://unsplash.com/@qa9de?utm_source=medium&amp;utm_medium=referral">Mark Asthoff</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>When I moved to New York City, I kept hearing different people saying the same thing: I should watch out for the city in terms of personal safety. Even though, historically, NYC has become a much safer place than before (The troll tourist guide about New York in the 1970s: <a href="https://www.theguardian.com/cities/2015/may/18/welcome-to-fear-city-the-inside-story-of-new-yorks-civil-war-40-years-on">‘Welcome to Fear City’ — the inside story of New York’s civil war, 40 years on</a>), New York City leaves a full-of-fun but somewhat-terrifying image to the locals and people all around the world. <br>E.g. Here is the total crime by year from 1985 to 2014, showing the decrease in NYC crime rate since the 80s:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*kttZ-AMcK4hXTSf2jDqpzQ.gif" /><figcaption>data from UCR Statistics</figcaption></figure><p>Despite hearing all of these talks, I don’t think I ever heard anyone (even native New Yorkers), bring up any kind of data sources or statistics to prove their overall idea of borough safety. Being an analytics student, I had an itch to dive into this topic and actually figure out what the true reality of this situation is.</p><h3>What is the distribution of Crime in each borough?</h3><p>Since this is a broad topic that could be analyzed in various aspects, I decided to focus on my most pressing question: <strong>Do the different boroughs have significant differences in terms of crime level and crime type?</strong></p><p>People in NYC always say that some boroughs are safer than others. However, there’s a disproportionate amount of people who live in Manhattan and Brooklyn with fewer living in Staten Island and Queens, so it is difficult to assume that any of these boroughs are safer in terms of different populations. Having this in mind, I decided to dive into this question using various analytical techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*WfRVY7vof9WVrEs6Tqi6fw.png" /><figcaption>New York City has five boroughs: Manhattan, Bronx, Brooklyn, Queens &amp; Staten Island. Photo by <a href="https://nycmap360.com/">nycmap360.com</a></figcaption></figure><h3>Dataset Used</h3><p>For this project, I used the NYPD Complaint Data from <a href="https://data.cityofnewyork.us/Public-Safety/NYPD-Complaint-Data-Historic/qgea-i56i">NYCOpenData</a>. It contains all the NYC history crime data reported by NYPD through 2019, and I extracted the 2018 data from it to avoid any missing data in 2019. This exploratory analysis is conducted with Python and Tableau.</p><h3>Data Pre-processing</h3><h4>First Look of the Data</h4><ul><li>number of observations: 452,997</li><li>number of variables: 37 (including happening date and time, crime description, geographic data, suspect/victim data)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nya3wwniwLbJVRUloeEf6Q.png" /></figure><h4><strong>Re-categorize Crime Description to Crime Type</strong></h4><p>After taking a good look at this data and removing NaN data, I realized that this dataset is not ideal for analysis, even though it contains all kinds of variables such as crime happening time and even the suspect’s data for each event. The main reason is that crime type data is really confusing.</p><blockquote>E.g. At one event, OFNS_DESC column could be “HARRASSMENT 2” but PD_DESC column could be “HARASSMENT,SUBD 1,CIVILIAN”, which makes it really hard to be analyzed)</blockquote><p>The U.S. Department of Justice administers two statistical programs: Uniform Crime Reporting (UCR) Program &amp; National Crime Victimization Survey (NCVS). However, NYPD seems to have its own approach in recording the crime event, so I can’t interpret the data with an established method. Additionally, there are multiple columns that explain the same crime event with some confusing description.</p><p>Therefore, I decided to re-categorize the type of crime event based on these two systems and my understanding. After this, I managed to limit the number of unique types of crime to 21 (original dataset had at least 59 types) and make them more understandable.</p><pre>new_dic = {a: b for old_cat, str_name in zip(new_type_cat, new_type_name) for a, b in zip(old_cat, [str_name]*len(old_cat))}<br>df[&#39;new_category&#39;] = df[&#39;OFNS_DESC&#39;].map(new_dic)<br>df[&#39;new_category&#39;].nunique() # 21<br># The amount of unique category has been narrowed down to 21<br># The detailed methodology and approach could be found at my GitHub</pre><h3>Exploratory Analysis</h3><h4>Total Number of Crime: Not really what I expected</h4><p>According to this visualization, Brooklyn has the overall highest number of crime events, and Bronx, often considered a little messier area, has a lower crime number than Manhattan. This was a surprising finding for me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*1FCOMbJzI-8rorfzE7g2pQ.png" /></figure><p>With the data of the projected population in each borough (sourced from <a href="https://www1.nyc.gov/site/planning/planning-level/nyc-population/current-future-populations.page">the Department of City Planning</a>), I found out that though Brooklyn has the most events, Manhattan and Bronx both have a higher percentage of crime events per resident. (Bronx has the highest number of 6,887 per 100k residents). Another interesting thing is that Queens has the lowest average number of crime events (3,849 per 100k residents), even lower than the Staten Island (4,269 per 100k residents)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*uwBV8hENNS5orLrCcQfpFw.png" /></figure><p>But this isn’t the end. I would still like to do some more exploratory visualizations to get more insight from the data.</p><h3>1. Level of Crime: Understanding the Distribution</h3><p>Changing back to the total count of events, I used the same visualization to go into more detail within the level of crime in each borough (There are three levels of crime in New York State: Violation, Misdemeanor and Felony). From the graph below, I can tell that Misdemeanor, an offense of which a sentence in excess of 15 days but not greater than one year may be imposed, is the most popular level of crime in each borough, and it consists a similar percentage in each group (about 52% to 57%; Manhattan has the highest percentage of 57.2%). The second popular one is Felony, a serious offense for which a sentence would be more than one year, and the third one is Violation, a lesser offense for which a sentence only be no more than 15 days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*zDI4EJOv_VyckoqksmPp3g.png" /></figure><p>This gives us the following interesting information:</p><ol><li>Staten Island has a substantially lower percentage of Felony than the other 4 boroughs (which have about 31%). This could mean that Staten Island is a much more peaceful area, with not only a lower total crime number but also less serious ones. (This also means that the Violation level of crime in Staten Island has a much higher percentage than all the other areas)</li><li>To my surprise, Bronx also has a smaller percentage of Felony types of crime than the other 3 popular boroughs. This could mean that most of the crime that happens in Bronx is not pressing. This insight can affect the common belief of neighborhood security of Bronx. I will further examine this lead.</li></ol><h4>Statistics: Are boroughs’ frequency of crime at each level different from each other?</h4><p>To compare the distribution of level type in each borough, Chi-squared test can be used (test of independence), with the null hypothesis as “each crimes’ happening borough is independent of the boroughs’ level-of-crime classification.”</p><p>The test result (p=0.00) shows there is a significant relationship between the variables, meaning different boroughs have a different distribution of level of crime. With the table of standardized residuals, the result showed that most of the real data is distinctly different from the expected value.</p><pre>import scipy.stats as stats<br>import statsmodels.api as sm<br>chi2, p, dof, expected = stats.chi2_contingency(observed = two_way_table2)</pre><pre>print(&#39;chi-square statistic :&#39;, chi2)<br>print(&#39;p-value :&#39;, p)<br>print(&#39;degrees of freedom :&#39;, dof)</pre><pre>table2 = sm.stats.Table(two_way_table2)<br>table2.standardized_resids</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*tQid4mo3xpVNZs6ZnpH2Dg.png" /></figure><p>Therefore, I could further confirm a few things:</p><ol><li>Bronx does have a significant low felony-level crime event than Manhattan, Brooklyn and Queens. Most of its crime data is contributed from lesser crime.</li><li>Although Staten Island has overall fewer crime events, the violation-level crime event proportion is significantly higher in Staten Island. Since it doesn’t follow the regular distribution, this could mean that some specific crime events happen frequently in the borough.</li></ol><p>These scenarios would be further broken down in the crime event analysis.</p><h3>2. Crime type: Recognizing prevalent Crime Type</h3><p>I further research into crime type for each borough level. I listed the top 5 crime types in each borough, and it seems that there is no major difference among each borough. In each borough, major types of crime are all about Larceny_Theft, Harassment, Assault, Criminal_Mischief_Property and Offenses_against_Public_Order_Administration. The only difference happens in Staten Island, which has significantly lower-proportion of Larceny_Theft and Criminal_Mischief_Property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BU2mUj9Qii1iccJCtbPGvw.png" /></figure><h4>Statistics: Are boroughs’ frequency of each crime type different from each other?</h4><p>The test for crime category result (p=0.00) shows there is a significant relationship between the variables, meaning different boroughs have different distributions of each crime type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*itXieVIXFozpTUN5-GAdZA.png" /></figure><p>I summarized the result with a heatmap and list only the significant ones below: <br>p.s. The threshold was over 2.0 or below -2.0, and I also put the most significant high or low category in each area into a bold font</p><p>Brooklyn</p><ul><li>Significantly high-frequent crime: <strong>Forgery</strong>, Burglary, Weapon Problem, Gambling, Robbery, Sex Crime &amp; Social and Commercial-related Crime (Social_Commercial_related_Crime)</li><li>Significantly low-frequent crime: <strong>High-Value Theft,</strong> Assault, Frauds &amp; Offenses against Public</li></ul><p>Manhattan</p><ul><li>Significantly high-frequent crime: <strong>High-Value Theft</strong>, Forgery &amp; Sex Crime, Frauds</li><li>Significantly low-frequent crime: <strong>Harassment</strong>, Assault, Serious Assault, Arson, Property Mischief, Weapon Problem, Driving under the Influence, Motor Vehicle Theft, Offenses against Public, Robbery, Social and Commercial-related Crime &amp; Traffic Laws Violations</li></ul><p>Bronx</p><ul><li>Significantly high-frequent crime: <strong>Serious Assault</strong> (Aggravated_Assault), Assault, Drug Problem, Weapon Problem, Harassment, Offenses against Public (Offenses_against_Public_Order_Administration) &amp; Robbery</li><li>Significantly low-frequent crime: <strong>High-Value Theft</strong> (Larceny_Theft) &amp; Burglary</li></ul><p>Queens</p><ul><li>Significantly high-frequent crime: <strong>Traffic Laws Violations</strong>, Assault, Burglary, Property Mischief, Harassment &amp; Motor Vehicle Theft</li><li>Significantly low-frequent crime: <strong>Drug Problem</strong>, Weapon Problem, Forgery, Frauds, Gambling, High-Value Theft, Offenses against Public</li></ul><p>Staten Island</p><ul><li>Significantly high-frequent crime: <strong>Driving under the Influence</strong>, Property Mischief, Frauds, Harassment, Offenses against Public</li><li>Significantly low-frequent crime: <strong>High-Value Theft</strong>, Serious Assault, Assault, Burglary, Drug Problem, Weapon Problem, Gambling, Motor Vehicle Theft, Robbery, Sex Crime, Social and Commercial-related Crime, Traffic Laws Violations</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*hl8nVJAUOZMJ8GllTxjOkA.png" /></figure><p>Through this analysis, I have found some interesting insights:</p><ul><li>Being the most popular place in terms of crime events, Brooklyn has a lower frequency of Fraud and High-Value theft. This is also true in Bronx, Queens and Staten Island.</li><li>The data from Bronx and Brooklyn shows high frequencies of a few public-concerning crime categories such as weapons, drugs, rubbery and serious assault. This could be one of the factors that some people have conflicting opinions about the neighborhood safety of these places.</li><li>Manhattan&#39;s popular crime types, except sex crime, are mostly not physical crimes (violent crime) but the crimes involve personal or business property. This could be because of the high proportion of business or commercial districts in this borough.</li><li>Queens has a distinctly high frequency of crime in regards to vehicle and traffic law. This is a little different from close boroughs such as Manhattan and Brooklyn. It could be that Queens’ residents own more vehicles to commute, or Queens has more vehicle-related industrial areas than other districts.</li><li>The data shows that compared to others, Staten Island has significantly more drunk driving issues and not so many violent issues that usually are seen in areas with high population density.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HOtlwH7Anwi3POsT" /><figcaption>Photo by <a href="https://unsplash.com/@jacobybrandon?utm_source=medium&amp;utm_medium=referral">Brandon Jacoby</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Conclusion and Next Steps</h3><p>From the exploratory analysis and statistical approaches, I can say that different boroughs do have significant differences in terms of crime level and crime type with each other.</p><p>After this, I am intrigued to look into more data related to crime happening time, victim and suspect data, etc. I will combine the above findings with the new data to look into more detailed topics. (e.g. the correlation of the crime happening time with different crime types or the persons who got involved in)</p><p>Congrats and Thanks for your reading! Feel free to check up my <a href="https://github.com/HiIamJeff/NYC-Crime-Analysis-Project">Github</a> for the full codes and drop a message at cl3883@columbia.edu</p><p>If it helps, press clap as many as you like: )</p><p>Jeff Lu</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6134642b9833" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[F2P Data|Business Analytics 線上課程選擇 & 我的第一堂 Python 課 — Python for Everybody]]></title>
            <link>https://a1080211jeff.medium.com/f2p-data-business-analytics-%E7%B7%9A%E4%B8%8A%E8%AA%B2%E7%A8%8B%E9%81%B8%E6%93%87-%E6%88%91%E7%9A%84%E7%AC%AC%E4%B8%80%E5%A0%82-python-%E8%AA%B2-python-for-everybody-cd6adca78449?source=rss-a7ff7e0ca405------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd6adca78449</guid>
            <category><![CDATA[business-analytics]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[中文]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[coursera]]></category>
            <dc:creator><![CDATA[Jeff, Lu Chia-Ching]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 03:23:40 GMT</pubDate>
            <atom:updated>2019-07-14T08:47:42.944Z</atom:updated>
            <content:encoded><![CDATA[<h3>F2P Data|選擇 BA 線上課程 &amp; 第一堂 Python 課</h3><p>2018年中，為了要申請 Business Analytics/BA/MIS 碩士，我就開始 Data Science/Business Analytics 的自學。但身為一個大學不太碰數學，只有基礎統計和 R 知識的商院人，一開始面對滿滿的學習資源真的很選擇障礙…。我相信隨機挑一個課程，效果都不會太差，但最重要的是：如何最快最有效率的幫助我的 MS 申請也增加我的 BA 能力？</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ofMfrqFMfpaTH_RMvI_RQA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clément H</a> on <a href="https://unsplash.com/search/photos/computer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>本文適合對象</h4><p>這篇主要分享當時選擇線上課程的心得和 Python for Everybody on Coursera 課程，適合同樣剛進入這個領域的初心者。必須先說，同樣身為新手，我選擇在自己也非完全理解的階段就分享，是希望我能在還記得入門者的感受、困惑下，能趕快紀錄起在這階段我覺得有價值的觀點想法。(如果有任何指教或想補充的，歡迎留言或直接敲我 Linkedin 囉 : ) )</p><h4>有關選擇課程的研究</h4><p>由於我當時要一邊練英文一邊弄申請的到處跑，所以很自然地就想到靠線上課程入門 Python。但能彈性上課的 MOOC 課程卻又有另一個課題，那就是 Coursera、Udemy、edX 這些 MOOC 平台都有超大量的程式課程 (光在 Udemy 超過4.5顆星評價的 Python 課程有接近4000個！)，更不用算其他 Datacamp、Dataquest、Treehouse…等等專業機構。所以再真正開始學 coding 之前，我就決定首先確定自己要什麼，再來花點時間研究各類課程/平台的優缺點。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2lSuivr5s8rv9g4-N8_bQ.png" /><figcaption>在 Udemy 超過4.5顆星評價的 python 課程有接近4000個!</figcaption></figure><p>目標確定是非常重要的事， 就像我相信大部分學 programming 的人都是想要轉職，但也一定有看到這篇文章的人是單純學興趣或還只是在找方向，所以不隨波逐流的 Learning with purpose 是線上學習一定要有的觀念。</p><blockquote>“嘗試新方向”也可以是一種目標！</blockquote><p>我再次確定目標是 “精實又有彈性的 Python 課程，並且能在申請 profile 上加分”，就決定要找美國大學的線上課程來上。理由很自然的就是大部分大學的線上課程都有提供結業的 certificate 可充實自己的履歷，也有從入門到進階的不同學程讓學生比較有系統的學習。這樣的邏輯讓我先放棄了大多數人以&quot;實用&quot;為目的的學習方式，因此我先排除了 Udemy, DataCamp 這種平台</p><p>另一方面，“準備作品/做 project” 這件事雖然也很吸引人，但最後還是先被我放棄 (時間心力上的投入有太多不確定因素，且也不確定自己適合這樣硬幹)，不然主打 project-based、純文字形式的 Dataquest 應該也會非常有趣，甚至直接找個 Kaggle challenge 來做更快，也許等之後有機會再來試試。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u7HVRMmOevO0AZYHHhcLbw.png" /><figcaption>主打 project-based 的 Dataquest</figcaption></figure><p>題外話一下，MOOC 對申請 Master 的幫助其實非常的迷，根據個人經驗和網路資訊來看是沒有一定的實質影響力，但若用直覺去想&quot;工作外再進修學習&quot; 來證明對某領域真的有興趣，確實可以讓申請者的 Profile 更有說服力！</p><blockquote><em>p.s.1 某些特定科系(e.g. CMU MSIM BIDM) 會要求若非大學念相關科系，需要申請前先修一些具有 “學分數” 的程式課程；2019 UCLA 的 MSBA 線上說明會也有提到希望申請者主動列出修過的MOOC課程，甚至建議要有比較進階(非 intro 類)的課程經驗<br>p.s.2 在美國，從 MOOC 拿到的 certificate 或 online degree 都算是 post-secondary education (大學/碩士學歷也屬於這種)，所以都能主動跟申請學校表明自己有修線上課的經驗，只是在填寫申請資料階段要標明課程到底是有 certificate (只有證明) 或是 degree (有各科目成績的 transcript)</em></blockquote><p>在比較課程階段，我找了各種分享不同課程心得評價的文章/網站去做比較。我有把不錯的資源連結放在文章最後，但建議大家可以在比較課程之前先看過這篇文章想想，到底自己是適合上線上課程或是自己直接做專案。</p><p><a href="https://medium.com/@josh.temple/why-i-abandoned-online-data-courses-for-project-based-learning-17e350fd9347">Why I abandoned online data courses for project-based learning</a></p><h4>第一堂 Python 課 UNM — Python for Everybody on Coursera</h4><p>最後，我選擇投入了 UMN 密西根大學的 <a href="https://www.coursera.org/specializations/python?">Python for Everybody (P4E) Specialization</a>。大致理由可歸類如下:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQ1lkL67NL4F-yshR98mPQ.png" /><figcaption>Python for Everybody Specialization 的第一堂課</figcaption></figure><ol><li>P4E 在許多課程評論網站文章中都有超高的評價和分數，除了在 Coursera 本站上平均拿 4.8顆星外，在 MOOC 課程評論網站(e.g. Class Center )也拿超高分數。<br>p.s. 上過一些線上課程後，我自己有個挑課程的經驗，就是 Coursera 上拿低於4.5顆星的課程通常會有些課程設計或系統問題，所以建議在挑選課程或 specialization 時，可以把評分門檻標準拉高 (放在課程首頁的評論基本上看不到什麼實質有用的 review，通常要到課程內的論壇才會有些討論，所以有時間還是推薦直接用試用期上上看)</li><li>這個 specialization 是一連串包含5個不同科目的系列課程，含括最基礎的安裝 Python、簡易資料結構、網路爬蟲到使用資料庫 (SQL)，比起一般只有5周內容的單一堂課還要完整。雖然感覺範圍超大，但內容非常平易近人，很適合跨領域、完全無經驗者。<br>舉例，這系列的其中一個優點是，新手不須要太多先修知識、技術才能開始學習。除了上課工具是 Python 3，安裝容易且不須考慮新舊版本外，課程用的交作業/考試方式也非常直覺簡單，不用花太多時間在版本設定或安裝軟體上。這點也許感覺還好，但當你上過其他需要你先設定不確定之後用不用的到的 Github 或調整 package / Jupiter notebook 版本的課程，就能很明顯感受到這堂課的友善程度。<br>p.s. 儘管這些是該具備的能力且實務上會不斷碰到，但一開始太多設定只會讓學生卻步，會有種花了許多心力卻看不到實質成果的無力感。當我在其他進階課程搞系統或 package 的事情可以整天都沒有進度，我會回想、感謝這個 specialization 沒有讓我先體驗這種痛苦…</li><li>此外，這堂課的硬體品質很不錯，不但老師講話收音清楚，教學素材也很齊全，可以很方便的取得課程簡報、製作筆記。課程教授 Chuck 也是難得一見的好老師，說話非常有魅力也很有趣，看得出在製作課程上很有熱忱 (不是每個講師都是這樣哈哈…)且教學資源(助教/系統維護)很夠力。<br>p.s. 如果覺得老師講太慢，建議直接用1.5x倍速去聽</li><li>選擇這堂課的另一個好處是除了它的內容本身偏向資料處理，UMN 也有一個緊接著的 data science 相關 specialization 叫 Applied Data Science with Python，內容是運用 Python 去做各種 DS 操作。雖然說是不同老師群，但這兩個系列非常符合我的方向 (e.g. 在申請階段先完成第一個 specialization，之後再抓時間上進階課程)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ruZn084cwUgozB4p-P0hiw.png" /><figcaption>Chuck 老師這樣介紹 Python</figcaption></figure><p>由於這堂課本身非常完整，在學習上應該不會有太大的挫折或問題。不過若同樣是用 Coursera 上課的人可以記得，若對 Cousera 系統或課程有任何一點疑問，都記得要上 Discussion Forum 去查一下，大部分上面的討論都是你可能碰到的問題 (交作業系統問題、作業是否有 bug…)，甚至有更多額外補充或資源會分享在上面，這在其他更進階的課程學習上非常有幫助，會比一開始就直接去查 documents 更有效率！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F_59xCrRA5p4XPj-wwUjRw.png" /><figcaption>Discussion Forum 依課程區分討論區，非常能幫助學習</figcaption></figure><h4>總結</h4><p>總體而言，我非常滿意 Python for Everyone，它的課程編制和低門檻要求，讓這系列上起來壓力不大，也適合每天拿下班時間當作培養興趣或聽新知識的去學。雖然在第五堂 Capstone 的課程不太像前面幾堂按部就班的學習，會有點沒方向感，但整體的學習體驗還是非常不錯，邊處理申請邊上課大概花了我4個月的時間。</p><p>MOOC 一直以來都有低完成率的現象 (雖然用 drop out rate 去衡量課程好壞不太準)，我自己也有沒上完課的經驗 (JHU 的 R…)，所以衡量課程適不適合自己比很多人想像中的重要。</p><blockquote>我認為第一堂課應該以追求能有餘力上完並學到知識，而不用把課程的進階/深入程度當作是一個參考指標。等真的有興趣有基礎了，再自己去探索下一堂進階課或是不同的學習管道。</blockquote><h4>補充</h4><ol><li>UMN 前陣子又開了一個新的 <a href="https://www.coursera.org/specializations/python-3-programming">Python 3 Programming Specialization</a>，內容比 P4E 還要再深入一點，如果有其他程式經驗的人也可以直接試試</li><li>Python for Everybody 目前有把全部教學內容都放在 Youtube 上 (看起來跟 Coursera 有點不同)，可以先試試看 (<a href="https://youtu.be/8DvywoWv6fI">https://youtu.be/8DvywoWv6fI</a>)</li></ol><p>以下是當初有參考到的評論文章或網站，有時間真的建議慢慢看:</p><ol><li><a href="https://www.classcentral.com/report/best-programming-courses-data-science/">The Best Intro to Programming Courses for Data Science — Class Central Career Guides by David Venturi</a></li><li><a href="https://medium.com/free-code-camp/top-5-machine-learning-courses-for-2019-8a259572686e">The top Machine Learning courses for 2019</a></li><li><a href="https://medium.com/@josh.temple/why-i-abandoned-online-data-courses-for-project-based-learning-17e350fd9347">Why I abandoned online data courses for project-based learning</a></li><li><a href="https://medium.com/free-code-camp/the-best-data-science-courses-on-the-internet-ranked-by-your-reviews-6dc5b910ea40">The best Data Science courses on the internet, ranked by your reviews</a></li></ol><p>F2P Data 系列下一篇應該會是 Intermediate-level 的 Specialization 介紹，並會包含比較多更細更 specific 的課程心得。若有任何想法或回饋，歡迎留言或直接敲我 Linkedin 囉！</p><p>Congrats and Thanks for reading through all of it. Feel free to press clap as many as you want : )</p><p>Jeff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd6adca78449" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>