<?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 Sandy Liu on Medium]]></title>
        <description><![CDATA[Stories by Sandy Liu on Medium]]></description>
        <link>https://medium.com/@yanhuiliu104?source=rss-f9b5f6e56088------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*apXMtRxnzcm5FFuCXBO1og.png</url>
            <title>Stories by Sandy Liu on Medium</title>
            <link>https://medium.com/@yanhuiliu104?source=rss-f9b5f6e56088------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:40:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yanhuiliu104/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[Credit Scoring — Scorecard Development Process]]></title>
            <link>https://medium.com/@yanhuiliu104/credit-scoring-scorecard-development-process-8554c3492b2b?source=rss-f9b5f6e56088------2</link>
            <guid isPermaLink="false">https://medium.com/p/8554c3492b2b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[credit-cards]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <dc:creator><![CDATA[Sandy Liu]]></dc:creator>
            <pubDate>Fri, 06 Apr 2018 21:09:38 GMT</pubDate>
            <atom:updated>2018-04-06T21:09:38.265Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Do you know your credit score? Have you been denied credit and do not know why? Everyone who has ever borrowed money to apply for a credit card or buy a car or a house or any other personal loan has a credit file. Lenders use credit scores to determine who qualifies for a loan, at what interest rate, and what credit limits. The higher the credit score the more confident a lender can be of the customer’s creditworthiness. However, a credit score is not part of a regular credit report. There is a mathematical formula that translates the data in the credit report into a three-digit number that lenders use to make credit decisions but the exact formula bureaus use to calculate credit scores is a secret.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*ggj1w_uwWO2GgguEbJFu9g.jpeg" /></figure><p>The purpose of this project is to use credit scoring techniques that assess the risk in lending to a particular client and build a scorecard model. Credit scoring means applying a statistical model to assign a risk score to a credit application and it is a form of Artificial Intelligence, based on predictive modelling, that assesses the likelihood of a customer defaulting on a credit obligation, becoming delinquent or insolvent.</p><p>Over the years, a number of different modelling techniques for implementing credit scoring have evolved. Despite diversity, Credit Scorecard model stands out and is used by nearly 90% of scorecard developers. As a statistical/machine learning hybrid, its scores can be directly used as probability estimates and hence to provide direct input for risk-based pricing.</p><p>Next, details about how to use credit scoring to build a consumer credit scorecard will be listed as follows. The analysis will include exploratory data analysis, variable selection, model building, and scoring.</p><blockquote>Exploratory data analysis</blockquote><p>Credit scoring data set that is used in this project is from Kaggle. In the beginning of every modelling procedure, the first question to ask is what we are trying to predict by the model. In credit scoring , this is the predictor/dependent variable. It has a binary value of either 1 or 0. A value of 1 means that the borrower is delinquent and has defaulted on his loans for the last 2 years, while a value of 0 means that the borrower is a good customer and repays his debts on time for the last two years. Dependent variable here is ‘SeriousDiqin2yrs’ as shown in the second column in the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*IInjy2UYscZOmgOoEhaQYA.png" /><figcaption>Figure 1. Explore data — missing values and outliers</figcaption></figure><p>It is common that most financial industry data contains missing values, or values that do not make sense for a particular characteristic. As seen in the table, this dataset also has missing values and outliers. Since we deal with estimation of client’s creditworthiness using logistic regression model, we impute missing values using median and drop the illogical values.</p><p>For example, the ‘age’ variable is a continuous variable from 0 to 100. There were certain records, which had a value of zero, that did not make sense and to be qualified as a borrower, the person must be an adult of 18 years. Therefore, we consider these values as missing values and choose to drop these values. In addition, the ‘RevolvingUtilizationOfUnsecuredLines’ feature is a ratio of the total amount of non-secured debt to the total non-secured credit limit and this feature should have values between 0 and 1, but some of the records have values greater than 1. In this case, there are outliers in the ‘RevolvingUtilizationOfUnsecuredLines’ feature and we choose to pre-process outliers by using top-coding method which means that all values that are above the upper band will be arbitrarily set to the upper band.</p><blockquote>Discretizing Predictors/Binning</blockquote><p>Binning means the process of transforming a numeric characteristic into a categorical one as well as re-grouping and consolidating categorical characteristics. In the process of developing scorecard, why binning is required? Reason is that some characteristic values can rarely occur, and will lead to instability if not grouped together. Therefore, grouping of similar attributes with similar predictive strengths will increase scorecard accuracy. Example of grouping ‘age’ feature is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*iKPdPXWNB5_jkqX1tmUMtA.png" /><figcaption>Figure 2. Example of grouping ‘age’ feature</figcaption></figure><blockquote>Scorecard — Model Building</blockquote><p>Before building scorecard model, two additional steps are needed. One is to calculate Weight of Evidence, the other step is to calculate Information Value (IV) based on WoE value,.</p><p>For verification of binning results we use WOE values. After splitting a continuous variable into few categories or to group a discrete variable into few categories for every features, we can calculate Weight of Evidence (WoE) value and then the categorical values are replaced by the WoE values which can be used later for building the model. Details about calculation of WoE is in the following section.</p><blockquote>Weight of Evidence (WoE)</blockquote><p>WoE measures the strength of an attribute of a characteristic in differentiating good and bad accounts and is based on the proportion of good applicants to bad applicants at each group level. Negative values indicate that a particular grouping is isolating a higher proportion of bad applicants than good applicants. It is a measure of the difference between the proportion of goods and bads in each attributes. For example, the odds of a person with that attribute being good or bad and negative WoE values are worse in the sense that applicants in that group present a greater credit risk. For each group i of a characteristic WOE is calculated as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*r5yNGKBdNxqPEbl519uaSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*_iNjtD2mdr1Tq2uCDf2kCw.png" /><figcaption>Figure 3. Example of WoE result of ‘age’ feature</figcaption></figure><p>After calculating WoE in each group of all characteristics, what needs to be confirmed is that an overall trend of are logical, and there is no data quirks. Logical relationships ensure that the final weightings after regression make sense and this also ensures that when attributes are allocated points to generate a scorecard, these points are logical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ySRfLFTTuxPAlqSsmc0Cvg.png" /><figcaption>Figure 4. Logical WoE trend for age</figcaption></figure><p>Once we finish grouping the variables and calculating WoE, we do the rank that orders variable by Information Value (IV) to screen and select variables. Details about calculation of IV is in the following section.</p><blockquote>Information Value (IV)</blockquote><p>Information Value comes from information theory and is measured using the following formula. Information value is used to evaluate a characteristic overall predictive power.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*M66hJ0Vb751-4QvVTJ-myA.png" /></figure><p>IV is a convenient rule of thumb for variables selection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*2zQUa-vt1lcslY_3yFVdrg.png" /></figure><p>Notice that the information value for NumberRealEstateLoansOrLines is 0.116 which is barely falling in the medium predictors’ range and it is unpredictive. Typically, variables with medium and strong predictive powers are selected for model development. Therefore, we do the feature selection and choose 8 features out of 9 features according to IV values as shown in the red highlight box below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*0V3QG1AU-QGCa2S7DXtCVA.png" /><figcaption>Figure 5. Information value of features</figcaption></figure><blockquote>Scorecard Development</blockquote><blockquote>We deal with the modelling of the scoring function and estimation of client’s creditworthiness using logistic regression model. The regression coefficients are used to scale the scorecard. Scaling a scorecard refers to making the scorecard conform to a particular range of scores. Big picture of scorecard development is shown as follows.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*mZ1wiojHXxX1mMTLggO6ag.png" /><figcaption>Figure 6. Big picture of scorecard development</figcaption></figure><blockquote>Score-points scaling</blockquote><p>Scaling a scorecard refers to making the scorecard conform to a particular range of scores and the regression coefficients are used to scale the scorecard. Logistic regression models are linear models, in that the logit-transformed prediction probability is a linear function of the predictor variable values. Thus, a final scorecard model derived in this manner has the desirable quality that the final credit score (credit risk) is a linear function of the predictors, and with some additional transformations applied to the model parameter, a simple linear function of scores that can be associated with each predictor class value after coarse coding. So the final credit score is then a simple sum of individual score values that can be taken from the scorecard.</p><p>For each attribute, its Weight of Evidence (WoE) and the regression coefficient of its characteristic now could be multiplied to give the score points of the attribute. An applicant’s total score would then be proportional to the logarithm of the predicted bad/good odds of that applicant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*Um1-BUnbfAIw9dqYVT7sTg.png" /><figcaption>Figure 7. Logistic regression coefficients</figcaption></figure><blockquote>Score-points scaling mechanism and calculator</blockquote><p>We choose to scale the points such that a total score of 600 points corresponds to good/bad odds of 50 to 1 and an increase of the score of 20 points corresponds to a doubling of the good/bad odds.</p><ul><li>Scaling — the choice of scaling does not affect the predictive strength of the scorecard</li><li>‘Points to double the odds’ (pdo = 20)</li><li>Factor = pdo / ln(2)</li><li>Offset = Score — {Factor * ln(Odds)}</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*d4RKVz5HRoOMaGPNmpFsCA.png" /></figure><blockquote>Decision from Scorecard</blockquote><p>Below is one calculation score result from using the score formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*g1a-ZTA4aPR0jmW4wU4tpA.png" /></figure><p>Generally speaking, the cut-off score will differ from one type of loan to another, as well as between lenders. Some loans require a minimum score of 620, while others may accept scores less than 620. Therefore, after getting cutoff score, we can then decide whether to approve the loan or not. Scorecard example below from online gives a better understanding of how it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*ng-cIdKoFMK9u3qHudNCYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*XPJhcHs3rUG7h7wvHNTk3w.png" /></figure><blockquote>Conclusion</blockquote><p>Overall, the predictive model learns from by utilizing a customer’s historical data together with peer group data and other data to predict the probability of that customer displaying a defined behavior in future. They not only identify ‘good’ applications and ‘bad’ applications on an individual basis, but also they forecast the probability that an application with any given score will be ‘good’ or ‘bad’. These probabilities or scores, along with other business considerations, such as expected approval rates, profit, churn, and losses, are then used as a basis for decision making.</p><p>That is all about this machine learning project for now. If you have any questions or comments, feel free to contact me or leave comments below. If you have interests in data science, feel free to check this <a href="http://www.weclouddata.com/">link</a> (WeCloudData). Thank you so much for taking the time to read this blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8554c3492b2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Digital Marketing Data Analysis Using Google Analytics API and Python]]></title>
            <link>https://medium.com/@yanhuiliu104/digital-marketing-data-analysis-using-google-analytics-api-and-python-112125f95dc2?source=rss-f9b5f6e56088------2</link>
            <guid isPermaLink="false">https://medium.com/p/112125f95dc2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Sandy Liu]]></dc:creator>
            <pubDate>Mon, 02 Apr 2018 02:54:49 GMT</pubDate>
            <atom:updated>2018-04-02T02:54:49.569Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Analytics is a freemium web analytics service offered by Google that tracks and reports website traffic — Wikipedia</p><blockquote><strong>Who is visiting your site? What they are looking for and how they are getting to your site? If you want to know statistics about the visitors to your website in order to expand and grow business on the internet, Google Analytics should definitely be your first choice.</strong></blockquote><p>The purpose of this project is to help a startup data science educational institution analyze website audience data and discover useful insight for the management. With the various devices in use today, even just by one person, it is really important to look closely at how desktop, mobile and tablet users interact with website everyday or even week so that owner can find out if there are any significant concerns which need to be addressed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*pRzUphMAzUVDlBap2Zp3Eg.png" /></figure><p>In this case,the first target audience I would like to focus on is technology. 3 questions I am pretty interested are listed as follows and all of them are based on the analysis of three different devices including desktop, mobile and tablet.</p><ul><li>At what time of day does website get the most traffic for three different devices?</li><li>What time of day does website perform best in terms of goals such as the number of new users reaches 1000 at 11am?</li><li>What is the difference between new user and returning user’s average session duration time at specific pages?</li></ul><p>Google Analytics provides an enormous amount of information including website traffic data that can give answers to these questions. To get started using the Google Analytics Reporting API first thing to do is to create a project in the Google API console, enable the API, and create credentials. Then Analytics Service Object is used to query the Analytics Reporting API V4 and data gets retrieved containing metrics based on device dimensions from API. ‘Dimensions’ and ‘metrics’ that are used to create desired reports in Python are shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*aEFnMjw9kzpjhW0QBXkJFg.png" /><figcaption>Figure 1. Useful ‘dimensions’ and ‘metrics’ to create reports in python</figcaption></figure><p>Dimensions and metrics explorer lists and describes all the dimensions and metrics available through the Core Reporting API. Details of all the dimensions and metrics are <a href="https://developers.google.com/analytics/devguides/reporting/core/dimsmets">in this link.</a></p><p>Once data is collected successfully, it is ready to do data preparation and analysis. Pandas library is imported in python to create data frames and process extracted data. Finally, Python graphing library plotly are used to create data visualization. Let us first take a look at of 24-hour Traffic Report.</p><blockquote>Hour of Day Report</blockquote><p>Before exploring actual data, we expect to see spikes during the day when people are awake and have predictably busy periods during weekdays because people may take a look at of website just before school or work in the morning or at lunchtime or right after school or work usually. In this case, traffic levels can be lower on weekends since most of people choose to relax and travel. Saying that, let us check the actual hourly traffic report from plotly result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*4hQtngJtPp0AtXMQ2HpUlQ.png" /><figcaption>Figure 2. Hour of Day Report</figcaption></figure><p>It is better to pick a large data range. The more data we have, the clearer the results in the hourly report will be and here we choose to pick data that ranges from Oct 1, 2017 to Mar 1, 2018. This Hourly Traffic Report shows share of traffic the three devices get which is different from what we expected before. In the figure, there is a huge spike appearing at 11am from desktop and the percentage of desktop starts decreasing from 4pm. Since the number of tablet’s new users is much smaller compared to the mobile and desktop, it is reasonable to skip fluctuation of tablet for now and mainly focus on the rest of two devices. If we look at desktop line chart, the percentage of new users from mobile remains stable from 11am and starts to decrease from 8pm.</p><p>Identifying the peak times of the day when the website receives traffic helps owner make decision and do promotion. For example, if the trend starts decreasing at night, then the owner can consider adding a special offer on the website that ends at midnight to attract more new users and create a last minute rush of registration. If the peak is around lunchtime and afternoon like desktop and mobile, then make sure to promote the website with advertising heavily around 11am, just before lunchtime, to draw in the biggest number of visitors. In addition, this report is ideal for time of day bid adjustments on paid advertising platforms, such as Google AdWords or Bing Ads, which allow the owner to adjust bids at different times of the day.</p><p>Let us then turn to Day of Week Report and take a further look at share of the three devices for new users in a week</p><blockquote>Day of Week Report</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*_volJuWe-XqgKHcsF2QxOg.png" /><figcaption>Figure 3. Day of Week Report</figcaption></figure><p>This Daily Traffic Report delivers different information. In the figure, we can see a spike on Tuesday and then there is an overall decreasing trend until Saturday for desktop. However, the overall trend is increasing starting from Wednesday and to Saturday for mobile. Peak days appear on Tuesday and Friday for tablet.</p><p>The statistics for different days of the week are important to look at if the owner wants an idea of how a visitor’s mood might change throughout the week. We can highlight the best and worst days of the week and get an insight what potential day that new users would be likely to make decision online in the middle of the week. For the best day, strategies like adding a special offer on the website on that day may help new users make decision faster and adjusting date of events to Wednesday may also attract more users on that day. As analysis from hour of day report before, this report is ideal for time of day bid adjustments on paid advertising platforms as well.</p><blockquote>Average Session Duration at Different Pages Report (New Users vs. Returning Users)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*40qppSQLfwHSRhnaZIUXSw.png" /><figcaption>Figure 4. Average Session Duration at Different Pages Report (Three Devices, New Users)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*HLogAcgAMmtLZt69VoLurw.png" /><figcaption>Figure 5. Average Session Duration at Different Pages Report (Three Devices, Returning Users)</figcaption></figure><p>For both new users and returning users, the highest average session duration time is on courses page except for mobile new users which appears on learningpath page. After discussion with operation manager and refer to other statistics, we get a conclusion that the learningpath page is not mobile friendly so that mobile users are likely to spend more time on that page.</p><p>Now we can see how well the website performs at different times of the day , different days of the week and what is the average session duration time on different pages for three different devices. Overall, since Google Analytics benefits business by providing more insight into the people who visit website, we can add more functions to the website such as video views and live chats for new users as well as promoting special offer for returning users in order to keep people on the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*OunTKDFdKMc3VydBTkCy2Q.jpeg" /><figcaption>Figure 6. Digital Marketing Landscape (Online source)</figcaption></figure><p>Google analytics is a powerful tool. With the platform’s reporting capabilities,marketers can collect, present, and compare any data set or combination of data sets. Marketers that want to better understand their audience, and strengthen their marketing strategy, need to know how to best utilize all of the data available inside Google Analytics. They can switch goals to get different great insights into how people interact with their websites through using Google Analytics.</p><p>That is all about google analytics project for now. If you have any questions or comments, feel free to contact me or leave comments below. If you want to know more about this project’s client, WeCloudData, and have interests in data science, feel free to check this <a href="http://www.weclouddata.com/">link</a>. Thank you so much for taking the time to read this blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=112125f95dc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time to Go Fishing in Ontario Canada]]></title>
            <link>https://medium.com/@yanhuiliu104/time-to-go-fishing-in-ontario-canada-6b4e989ea60e?source=rss-f9b5f6e56088------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b4e989ea60e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Sandy Liu]]></dc:creator>
            <pubDate>Wed, 14 Mar 2018 00:01:29 GMT</pubDate>
            <atom:updated>2018-03-14T00:01:29.545Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Are you looking for a good fishing spot around Ontario? Do you ever wonder which fish species are in your favourite lake in Ontario? If the answer is yes, then it is time to read this blog and plan a wonderful fishing adventure!</blockquote><p>When you are eager to find more lake and fish species information, you may choose to search keywords ‘fishing Ontario’ on Google and an official Ontario fishing website then pops up in a Google search. This official Ontario fishing provides a lot of information that used to be hard to find. Now information about the various species of fish found in a certain lake, fish stocked in lakes, regulations for the lakes, and some information about the lake itself is available online.</p><p>However, if you are an experienced fishing enthusiast and often uses interactive mapping on this website, you may notice that fish on-line function does not work as good as you expect to search for specific information. Sometimes, it takes effort to search for fishing spots by the name of the lake and even when you get the lake location, you may be redirected to another place once you try to zoom in the lake location on map. One of my colleague who is a fishing enthusiastic guy feels frustrated because of this situation and comes up with the idea of building an efficient interactive lake information system using Google map. Our group is all inspired by this idea and decide to work on this fishing interactive system using python at <a href="http://www.weclouddata.com/">WeCloudData</a>.</p><h3><strong>Data Collection</strong></h3><p>Our project starts by collecting lake and fish species information from fishing website first. There are several tools and tactics for obtaining this data. For our project, we use Selenium to extract and collect desired data since Selenium is designed as web UI automation tool and developed to better support dynamic web pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*N-P6l_wrXXMWPv5bXnvoXQ.png" /><figcaption>Figure 1. Flow Chart of Data Collection</figcaption></figure><p>Our python code can navigate to the fishing website and simulates people’s behaviour such as clicking a button as well as moving the mouse from one menu link to the other. To implement these functions, we use the click method from Selenium package to interact with different pages. If we want to target elements which are located on specific page and extract relevant content subsequently, we prefer using methods like driver.find_element_by_xpath. It is noteworthy that there is a slight delay between each menu option. Hence, sleep method is crucial for asking the Selenium-WebDriver to wait for few seconds while the page is still loading. Given that we can automatically extract all data from lake zone16 in Ontario using Selenium.</p><p>To see how Selenium works to reach target page and extract lake information, check the following videos.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FveLFRJLCXC0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DveLFRJLCXC0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FveLFRJLCXC0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/14a1ccacf061b21d752de1b31f6047fb/href">https://medium.com/media/14a1ccacf061b21d752de1b31f6047fb/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs11vBGg0qCE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds11vBGg0qCE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs11vBGg0qCE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd9e83a5db4aefab4529f0f992f59b24/href">https://medium.com/media/bd9e83a5db4aefab4529f0f992f59b24/href</a></iframe><h3>Data Processing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*4eTGkD8cEUVdZ8_QBMON1Q.png" /><figcaption>Figure 2. Useful Data in Red Box</figcaption></figure><p>After successfully extracting lake information data, we can focus on data processing. For each lake, there are five categories including Waterbody, Regulations, Fish, Stocking and Survey. Since Survey requires the user to submit personal fishing experiment information and most information under Stocking category is not available, we decide to delete these two categories from dataset. As for Regulations category, because we are focusing on zone 16 in Ontario right now and only one regulation exists, we skip this category for now and will append this information later to our dataset once we extract more data from other Ontario lakes. Therefore, in the end, seven features including Lake Name, Municipality, Geographic Township, MNRF District, Coordinates, Waterbody and Fish Species under Waterbody category remain in our dataset and all data from 669 lakes in zone 16 is saved to a local txt file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*ikTCe6_fmV53s0clkhbFUw.png" /><figcaption>Figure 3. Part of Final Data Frame</figcaption></figure><p>In order to organize and display dataset more clearly and efficiently, local txt file is finally converted into csv file using python. CSV (a comma-separated values) file can store numerical and text values in a text file where columns in csv file are lake features. The data can then be easily load in Python as a data frame (shown above) with the function pd.read_csv in pandas which allows us to do further processing in the future.</p><h3>Data Visualization</h3><p>In order to communicate information in easily digestible visuals, three visualization packages are used in our project. These three visualization packages are Folium, gmaps and googlemaps and details will be listed as follows.</p><h4>Map Visualization with Folium</h4><blockquote>Folium is a powerful Python library that helps to create several types of Leaflet maps. The fact that the Folium results are interactive makes this library very useful for fancy map building.</blockquote><p>When running python code, it creates a map with location markers that are clustered if close together. If you click on any cluster on the created map you are interested in, it can make the clusters split. The blue marker represents an individual lake. You can check the following the video and see how it works.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfpcEh0znpY4&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FfpcEh0znpY4&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f7bfa5acdefd6dc57b0e6ca333c0afe/href">https://medium.com/media/9f7bfa5acdefd6dc57b0e6ca333c0afe/href</a></iframe><p><a href="https://jsfiddle.net/zuyqg3dx/1/embedded/result/">Click here to see interactive map</a>.</p><h4>Map Visualization with Google map</h4><blockquote>Googlemaps package is used to access google map from python and API key is necessary in order to configure the googlemap. Once the configuration is completed, three functions including search function, duration function and heap map function in our project can then be implemented to display desired results on google map.</blockquote><p>Search function: This function allows user to input partial lake name and check relevant lake information. If the user’s input characters are in our database, python will return a Googlemap that has all qualified lake name with relevant information. Otherwise, it returns information showing that lake name is not found and asks the user to try it again. Please check the following video to get a further understanding of how this function works.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBnSuZo4qAxY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBnSuZo4qAxY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBnSuZo4qAxY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5ac64abd6e7314c7429030af0d9dfd9/href">https://medium.com/media/f5ac64abd6e7314c7429030af0d9dfd9/href</a></iframe><p>Duration function: Duration function allows user to set up current location and choose travelling mode including driving , walking, bicycling and transit mode to each desired lake. Based on lake location that the research function returns previously, direction, distance and duration time between current location and lake locations will then be calculated for user. The following video can show how it works.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU09iMMOzTO4%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU09iMMOzTO4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FU09iMMOzTO4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad08b56783ee48bd71f899b279fc4609/href">https://medium.com/media/ad08b56783ee48bd71f899b279fc4609/href</a></iframe><p>Heat Map: After figuring out direction to the desired lake, species information becomes necessary. Heat map then allows the user to see density of lake as well as species information. It asks user to choose preferred fish species from the given fish species dictionary and then returns density of fish species on google map as shown in the following image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*Cqqep9Yw4H9FzgDCzbETCQ.png" /><figcaption>Heat Map of All Lakes in Zone 16, Ontario</figcaption></figure><p>You can check the following video to see the demo of our heat map.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F16Fa32ET9OI%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D16Fa32ET9OI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F16Fa32ET9OI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/82e5aa61bb3ef34ed66eba154b7ab85b/href">https://medium.com/media/82e5aa61bb3ef34ed66eba154b7ab85b/href</a></iframe><p>That is all about our project for now and our group is still trying to improve functions in our project. If you have any questions or comments, feel free to contact me or leave comments below. Thank you so much for taking the time to read this blog.</p><p>Enjoy your fish trip!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b4e989ea60e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>