<?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 Tin En Hao on Medium]]></title>
        <description><![CDATA[Stories by Tin En Hao on Medium]]></description>
        <link>https://medium.com/@tinenhao?source=rss-7cf182518748------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SnTuoByQrEHP5g_x.</url>
            <title>Stories by Tin En Hao on Medium</title>
            <link>https://medium.com/@tinenhao?source=rss-7cf182518748------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:19:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tinenhao/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[Final Report — An optimization of taxi services in Singapore by Team 1]]></title>
            <link>https://medium.com/budding-data-scientists/final-report-the-optimization-of-taxi-services-in-singapore-through-data-analysis-b5ab7263672d?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5ab7263672d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[taxi]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[social-impact]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 15:48:43 GMT</pubDate>
            <atom:updated>2018-08-15T02:32:48.754Z</atom:updated>
            <content:encoded><![CDATA[<p>Tin En Hao (Leader), Justin Tan Chern Lin, Yeoh Yong Jie</p><h3>Introduction &amp; Rationale</h3><p>In Singapore, taxi services have played an important role in transportation with a daily ridership of 785,000 as of 2017. However, based on a survey released by the Public Transport Council, the daily ridership of local taxi companies have tumbled 18% from 2016. This can be attributed to the ineﬃcient system of local taxi companies which has caused commuters to<br>be unsatisﬁed. Based on a survey conducted in 2013 by LTA, it was found that 96.4% of the 1200 survey respondents felt that waiting time to be important yet only 86.2% felt satisﬁed by the waiting time. The 10.2% gap between expectation and satisfaction clearly points out the ineﬃcient system of local taxi services (Adrian, 2015). Another reason for the decline in taxi ridership may be the presence of private-hire car company — Grab in Singapore. Thus, there is a need to assist local taxi companies as they play a vital role in the ﬁeld of transportation as well as the economy. Otherwise, local taxi companies may face the threat of being eliminated from the market. This project will make use of open data provided by the Singapore government to ﬁnd solutions to increase the eﬃciency of taxi services.</p><h3>Objectives</h3><ol><li>To create a supply heat map and identify factors which correlate to demand.</li><li>To identify the shortest path to reach a destination based on the Dijkstra’s algorithm.</li><li>To redistribute the taxis to achieve the ideal allocation of taxis in each region.</li></ol><h3>Research Questions</h3><ol><li>How to create a supply heat map and identify factors which correlate to demand?</li><li>How to identify the shortest path to reach a destination based on the Dijkstra’s algorithm?</li><li>How to redistribute the taxis to achieve the ideal allocation of taxis in each region?</li></ol><h3><strong>Literature Review</strong></h3><p>Since the late 20th century, extensive studies have been conducted in relation to the taxi sector. The ﬁrst few studies were focused on studying the proﬁtability of the sector and the necessity of using regulation. Since then, the later studies have evolved to include many other factors such as congestion, elasticity of demand, diﬀerent market conﬁgurations, diﬀerent user<br>classes etc. to create a more realistic market. The precursor of the ﬁrst few studies was conducted by Douglas in 1972. His study considered a taxicab market where taxicabs can be engaged anywhere along the city streets, with scheduled (by a regulatory authority) fares, and free entry. He concluded that the maximum revenue to the industry occurs at the point where demand is less than maximum, characterizing social welfare as an eﬃcient but unfeasible (deﬁcit) equilibrium. He also proved that taking into account the social welfare, the points where the number of taxi hours in service is maximized and where demand is max are the same (Josep et al., 2011).</p><p>Another example was through the reasonable analysis of the diﬀerent time and space residents travel intensity, an optimization model was established to achieve the best matching degree of supply and demand, which provides a scientiﬁc, reasonable and feasible basis for the management department (Xiaopeng, Xinyuan, Xian, 2016). These studies proposed mathematical formulas for calculating demand and supply, simulating diﬀerent types of markets and obtaining diﬀerent results for each regulation scheme. Aggregated models calculated total demand and supply using diﬀerent parameters. However, these studies only cover the optimal supply of taxis and the ways to generate maximum revenue but not the ideal allocation of taxis<br>across the region. Thus, this project aims to assist in optimizing the allocation of taxis in Singapore.</p><p>Dijkstra’s algorithm is an algorithm for ﬁnding the shortest path from a starting node to a target node in a weighted graph. This algorithm creates a tree of shortest paths from the starting vertex to all the other points. This would generate the shortest distance between each and every node on the weighted graph (Thaddeus, Hannah &amp; Christopher, 2016). The Maximum<br>Flow algorithm is an algorithm to distribute objects in a weighted graph by maximizing the amount of ﬂow in the network. A maximum ﬂow indicates the most eﬃcient distribution with the minimum cost (Kumar, n.d.). With the help of the Dijkstra’s algorithm to identify the shortest route and the Maximum Flow algorithm to redistribute the taxis in the most eﬃcient<br>manner, this project aims to identify the ideal positions of the taxis at a given time to optimize the services of the taxi industry.</p><h3>Methodology</h3><ol><li>Collect data on taxi availability and co-ordinates from Singapore’s open data portal.</li><li>Use the data to plot a supply heat map and identify factors which correlate to demand.</li><li>Find the shortest path to reach the destination based on the Dijkstra’s algorithm.</li><li>Identify regions in Singapore with an oversupply or under-supply of taxis and apply the Maximum Flow algorithm to redistribute the taxis.</li></ol><h3>Results</h3><blockquote><strong><em>Objective 1</em></strong></blockquote><p>Methodology:<br>1. Create an algorithm using R to collect data on taxi availability online</p><p>2. Process and clean the data obtained</p><p>3. Create a supply heat-map using Tableau</p><p>4. Identify factors which correlate to demand</p><p>The data for taxi availability used in this project was obtained from <a href="http://www.data.gov.sg/">www.data.gov.sg</a> and it contains the co-ordinates of all available taxis which is refreshed every 30 seconds. The data was collected over a 2 months per minute (1440 ﬁles per day). The 10th (Sunday) and 11th (Monday) of June was chosen to create the heat-map (Figure 1) as served as a representation<br>of weekdays and weekends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*cyq7l0EfRTsPAjLLOI4sxA.png" /><figcaption>Figure 1: Taxi supply heat-map during 10th June 12pm</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*mg8MWqv0jWAdEoM98JnbvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*4SSk3QzP2NDa6Xi718ER0g.png" /><figcaption>Figure 2: Amount of available taxis over a weekday (left) and a weekend (right)</figcaption></figure><p>Drawing a comparison between the graphs (Figure 2) of the amount of available taxis over a weekday and a weekend, it can be observed that there is a higher number of available taxis across all time periods and this can be attributed to the higher amount of taxi drivers working during weekends. Furthermore, it can be observed that both graphs possess similar shape as<br>seen from the same trends in the same time period e.g. sharp decrease in taxi availability during dinner time.</p><p>Next, this project made use of the residential population distribution in Singapore obtained from onemap.sg and the movement of passengers across the EW line obtained from an analysis done online as a proxy to identify areas with high demand. However, this can only be achieved by making the assumption that the supply of taxis correlate to the demand. It was predicted<br>that the higher the residential population or the movement of passengers in the region, the higher the demand of taxis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VGGAv_iU3KKg3UgBUtXCCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQIGZ6eIE2KGujlIQBvXJA.png" /><figcaption>Figure 3: Population distribution (left) Movement of passengers in EW line (right)</figcaption></figure><p>Comparing these factors (Figure 3) to the taxi availability heat map, it can be concluded that our hypothesis holds true that the higher the residential population or movement of passengers in the region would result in higher demand for most cases. For instance places like Geylang, Bedok, Tampines etc. with high residential population has a high demand of taxis. However,<br>places like Jurong, Clementi etc. have a high residential population but low demand for taxis. Furthermore, the movement of passengers at Raﬄes Place, Outram, Tiong Bahru which has a high demand for taxis has a low movement of passengers in the MRT. Thus, it can be concluded there is either an under-supply of taxis or the proxy used is inaccurate. Although the comparison of data between the taxi distribution (1 day) and the movement of passengers<br>in MRT (2 months) may be inaccurate, but this comparison only serves as a proof of concept to determine the feasibility of this comparison. However, a concrete conclusion cannot be made due to the lack of data.</p><blockquote><strong><em>Objective 2</em></strong></blockquote><p>Dijkstra’s algorithm is an algorithm to ﬁnd the shortest path in an weighted graph by creating a tree of shortest paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QpneAcMybJTvKw--za6V0g.png" /><figcaption>Figure 4: Example of a weighted graph</figcaption></figure><p>In the weighted graph (Figure 4), A and B represents the starting point and the destination whereas the black lines denote all roads and the blue circles denote diﬀerent locations. The numbers denote the length of the roads. Below is the breakdown of the algorithm:</p><p><strong>Definition of variables used in the algorithm:</strong></p><p>Vertices denoted as <em>u</em> or <em>v</em></p><p>Weighted edges that connect 2 nodes; <em>(u,v)</em> denotes an edge &amp; <em>w(u,v)</em> denotes its weight</p><p><strong>Initialization:</strong></p><p><em>dist</em> → an array of distances from source node A to other nodes in the graph</p><p>At the start of the program,</p><p><em>dist(A) = 0</em></p><p>All other nodes <em>v, dist(v) = </em>∞</p><p><em>Q</em> → a set of all nodes in the graph (at the end, Q will be empty)</p><p><em>S</em> →an empty set which indicates which nodes have been visited (at the end, S will contain all nodes)</p><p><strong>Algorithm</strong></p><p>While <em>Q </em>is not empty, pope the nod <em>v</em></p><p>→ Which is not in <em>S</em></p><p>→ Smallest <em>dist(v)</em></p><p>Add node <em>v</em> to <em>S </em>to indicate it has been visited</p><p>Update each adjacent node <em>u</em> of the current node <em>v </em>as such:</p><p>→ If <em>dist(v)</em> + <em>w(u,v) </em>&lt; <em>dist(u)</em> , update <em>dist(u) </em>to new minimal distance</p><p>→Otherwise, no updates</p><p>Methodology:</p><ol><li>Download the Singapore map from open street map</li><li>Identify all roads in Singapore from the map</li><li>Use geosphere to calculate the distances of the roads</li><li>Apply Dijkstra’s algorithm on the map</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0qNvKjdfi46qSKddRUaaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sa2x-lFFAO1Sj0x6BRbpCw.png" /><figcaption>Figure 5: Results for Dijkstra’s algorithm (left) Results for Google maps (right)</figcaption></figure><p>Both values, the starting point(103.818, 1.3575) and the ending point(3.818, 1.3750) were input into the Dijkstra’s algorithm and the result was 2660.855m. Comparing this value with the value from Google Maps which is 2900.000m, it can be concluded that the Dijkstra’s algorithm is rather accurate with an error margin of 8.00% which is 239.145m.</p><blockquote><strong><em>Objective 3</em></strong></blockquote><p>Methodology:</p><ol><li>Divide Singapore into various regions and ﬁnd the centre of each region</li><li>Group the locations into points of oversupply and undersupply computed by comparing the base — case with the current data. The base — case is calculated by the average of all the data sets collected and divided into each hour and region.</li><li>Find the distance between each point using Dijkstra’s algorithm</li><li>Apply Ford — Fulkerson Maximum Flow algorithm on these locations to redistribute the taxis</li></ol><p><strong>Terminology:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*GQNSHKQgcS5DrCMp8ZHGZA.png" /><figcaption>Figure 6: Example of a Flow Network</figcaption></figure><p><em>Flow Network</em></p><p>• Digraph</p><p>• Weights, called capacities on edges</p><ul><li>Source S and Sink T<br><br><em>Flow Function on network edges</em></li><li>0 ≤ flow ≤ capacity</li><li>flow into vertex = flow out of vertex</li><li>Value of flow = flow into sink</li></ul><blockquote>Maximum flow → Maximum Distribution Minimum Cost</blockquote><p><strong>Ford-Fulkerson Maximum Flow Algorithm</strong></p><p>Find an augmenting path→Compute the bottleneck capacity→Augment each edge and total ﬂow</p><p><strong>Augmenting path</strong> → A path from Source to Sink made of non-full forward edges and nonempty backward edges.</p><p><strong>Bottleneck Capacity</strong> → The bottleneck capacity of an augmenting path is the minimum residual capacity (capacity−ﬂow) of any edge in the augmenting path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*si9INltkd7Kx96AzDj1E9w.png" /><figcaption>Figure 7: Ford — Fulkerson Algorithm</figcaption></figure><p>As seen in Figure 7, the red lines represent the augmenting path. Since the bottleneck capacity is 2, augment ﬂow value of 2 along the augmentation path. Value of ﬂow is updated accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FDRuayBBynMHGK8MiLBskQ.png" /><figcaption>Figure 8 : Maximum Flow</figcaption></figure><p>It can be observed from Figure 8 that an augmenting path does not exist in the graph, indicating that the Maximum Flow — 19, has been found.</p><p><strong>Program Algorithm</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6KsVKaX8ZxLRh74yhFBQw.png" /><figcaption>Figure 9: Program Algorithm</figcaption></figure><ol><li>Group all regions with oversupply and undersupply which will be connected to the Dummy Source and Dummy Sink respectively. The weights on the nodes connecting the Dummy Source and Dummy Sink with the regions would be determined by the amount of over/under supply of taxis</li><li>The weights on the nodes connecting the Dummy Source and Dummy Sink with the regions would be determined by the amount of over/under supply of taxis</li><li>Each region with an oversupply would be connected to all the regions with an undersupply and vice versa.</li><li>Perform a Binary Search to identify the 2 regions with the shortest distance and optimal ﬂow. This will reduce the number of times needed to run the Ford — Fulkerson Maximum Flow Algorithm to optimize the speed of the program</li><li>When the 2 regions with the shortest distance has been identiﬁed and has maximum ﬂow, taxis would be distributed through the node. Otherwise, Binary Search would be performed again to identify the next 2 regions with the shortest distance. This process would than repeat until all the taxis have been distributed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALieGDcR2pTa_7TwizlpSQ.png" /><figcaption>Figure 10: Sankey diagram</figcaption></figure><p>The Sankey diagram (Figure 10) shows the amount of taxis allocated from the region with oversupply (Left column) to the regions with under-supply (Right column) on 24th July 1400 hours. The thickness of the node indicates the amount of taxis allocated in each node i.e. the thicker the node, the higher the amount of taxis transferred.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7JrY6A7COdpO3x-vQLfLw.png" /><figcaption>Figure 11: Data collected on 24th July 1400 hours</figcaption></figure><p>Based on the Sankey diagram (Figure 10), it can be observed that there are a few regions with high amounts of over/under supply of taxis. Comparing it with the data collected on 24th July 1400 hours (Figure 11), it can be concluded that the program is a success.</p><h3>Limitation</h3><p>One limitation of this project is the lack of data collected. For this model to be accurate months and years of data have to be collected to form the base case. Another limitation of this project is the lack of technical knowledge which has limited the scope and depth of this project and the accuracy of the results. However, this project can still serve as a prototype or model which can be applied in real life.</p><h3>Further Extension</h3><p>One possible further extension of this project is to allocate individual taxis in regions with oversupply to regions with under-supply. In other words, not all taxis in the same region with oversupply would be allocated to the same region with under-supply. This would yield a more ideal allocation of taxis as the value of over or under supply would diﬀer for each region.</p><h3>References</h3><p>[1] Adrian L. (2016). Waiting time for taxis still biggest bugbear: Study. Re<br>trieved April 20, 2018, from h<a href="https://www.straitstimes.com/singapore/transport/">ttps://www.straitstimes.com/singapore/transport/</a>waiting-time-for-taxis-still-biggest-bugbear-study<br>[2] Kumar, V. (n.d.). Maximum Flow. Retrieved August 3, 2018, from <a href="https://www/">https://www</a>.hackerearth.com/practice/algorithms/graphs/maximum-flow/tutorial/<br>[3] Josep, M.S., Miquel, E., Georgia, A., &amp; Evangelos, M. (2011). A review of the modeling of taxi services. Retrieved August 6, 2018, from <a href="https://www.sciencedirect.com/">https://www.sciencedirect.com/</a>science/article/pii/S1877042811014005<br>[4] Thaddeus, A., Hannah, P., &amp; Christopher, W. (n.d.). Dijkstra’s Shortest<br>Path Algorithm. Retrieved April 23, 2018, from <a href="https://brilliant.org/wiki/">https://brilliant.org/wiki/</a><br>dijkstras-short-path-finder/<br>[5] Wing, Y. &amp; Kai, W. (2017). MRT Closures: What is the impact?. Retrieved June 20, 2018, from <a href="https://blog.data.gov.sg/mrt-closure-what-is-the-impact-9472027ccf4e">https://blog.data.gov.sg/mrt-closure-what-is-the-impact-9472027ccf4e</a><br>[6] Xiaopeng L., Xinyuan D. &amp; Xian C. (2016). A Study on Optimal Resource Allocation of Taxis. Retrieved July 15, 2018, from <a href="https://www.matec-conferences.org/articles/">https://www.matec-conferences.org/articles/</a>matecconf/pdf/2016/26/matecconf_mmme2016_04009.pdf</p><p><strong>Reflections</strong></p><blockquote>Tin En Hao</blockquote><p>This is the third year taking up a math project with the same group of people. However, taking up this data science project was essentially a leap into the unknown as we had no experience in this field. Thus, we faced tons of challenges in our project journey. One of the biggest challenge our group faced was the very first step — choosing our topic. Due to various reasons such as the lack of available data, we had changed our topic twice. Furthermore, even after we had determined our topic we still had a hard time trying to grasp the scope and focus of our project. Thus, the objectives and research questions of our project was constantly changing until 2 weeks before mid — term evaluation before we finally finalized our objectives and set the direction of our project. We still faced a lot of challenges along the way such as creating the various algorithms used in our project or the collection of our data but as the group leader of this group, I am proud to say that we managed to overcome these challenges as a team and produce our results. My biggest takeaway from this project is perseverance. For a prolonged period, our group was directionless as we could not decide upon a topic and the scope of our project. This left us with a sense of despair. However, our group persevered and had multiple meetings to conduct extensive research and finally we finalized the scope of our project. Although this is by far the toughest and hardest project we have taken up, it is also the project which gave us the most satisfaction as we have truly learnt a lot by coming out of our comfort zone and face these challenges. Lastly, I would like to thank my mentors for providing our group guidance which helped us succeed, the KDD Impact program which provided us with this opportunity and most importantly my groupmates who accompanied me in this wonderful journey.</p><blockquote>Yeoh Yong Jie</blockquote><p>Though we have been through ups and downs doing the project this year, we have managed to overcome them. This is the same group of people doing project for the third year, teamwork and communication is not a big challenge. They played a big part in our project, allowing us to work well with each other. By working closely with each other, we have managed to overcome the obstacles we face when working on the project. This is the third time doing a Math project, however data science is still a new term to me. There are lots of new concepts and knowledge for me to learn. Hence, I have gained a lot doing this project. For example, as I am mainly doing the algorithm, I learn a lot about R. All the functions and libraries are new to me, there are a lot of errors when executing the program. This trained my determination and problem-solving skills. At times, I also need to consult my mentor for suggestions. I am very grateful to have very helpful mentors. They have helped us much in this project, guiding us to our success. The biggest takeaway for me is to be adaptable. The greatest challenge we have faced is at the start of the year. Due to the lack of data, we have changed our topic two times. This leave us with very little time to work on our project. Besides that, doing this project is not an easy one as the data we can obtain is also limited. Hence, we need to change our research questions along the way as some are impossible to do. Luckily, we were adaptable, hence able to push ourselves to our limits, getting our results in time. At last, I would like to thank my mentors who provide guidance along the way and my groupmates for being considerate and co-operative.</p><blockquote>Tan Chern Lin, Justin</blockquote><p>We have been doing math project for 3 years. This year would be our final year having the opportunity to take part in the projects work. As a secondary 4, we set high expectations for ourselves, hoping to achieve something great. This year we embarked on a data science project, a field which we have close to no knowledge. As a team, we have to work to together to explore the various functions and concepts of data science, at the same time implement it to solve our objective. Choosing this path for our project wasn’t an easy one. We faced various challenges on the way like changing the topic we are investigating and not being able to understand the concepts. Fortunately, we asked for help from our external mentor. They provided us with guidance which we appreciate it very much. The biggest takeaway for me this year is not to stay in my own comfort zone. This year we felt satisfied about our project looking at our current progress. Leaving our comfort zone possess the risk of failing, but through hard work and determination, we overcome the challenges in our way. Teamwork definitely played a major role in our project. We had to distribute the work according to each of our strengths. This is especially important when we are embarking on a challenging project. We combined our knowledge to overcome the various challenges we faced on the way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5ab7263672d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/final-report-the-optimization-of-taxi-services-in-singapore-through-data-analysis-b5ab7263672d">Final Report — An optimization of taxi services in Singapore by Team 1</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An optimization of taxi services in Singapore through data analysis by Team 1]]></title>
            <link>https://medium.com/budding-data-scientists/an-optimization-of-taxi-services-in-singapore-through-data-analysis-644cbac2813d?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/644cbac2813d</guid>
            <category><![CDATA[transportation]]></category>
            <category><![CDATA[taxi]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Thu, 12 Jul 2018 03:19:21 GMT</pubDate>
            <atom:updated>2018-07-28T11:49:25.694Z</atom:updated>
            <content:encoded><![CDATA[<p>Tin En Hao, Yeoh Yong Jie, Justin Tan Chern Lin</p><h3><strong>Rationale</strong></h3><p>In recent years, private car hiring companies have entered the Singapore market and has caused the daily ridership of local taxis to decline drastically. Evidently, the business of local taxi companies have been negatively impacted by these private car hiring companies and these private car hiring companies certainly pose a threat to the survival of the local taxi industry. Thus, we think there is a need to assist local taxi companies to optimize their services through data analysis to ensure their survival.</p><h3><strong>Objectives</strong></h3><ol><li>To create a supply heat map and identify factors which correlate to demand.</li><li>To identify the shortest path to reach a destination based on the Dijkstra’s algorithm.</li><li>To forecast the supply and demand of taxis to assist in the allocation of taxis</li></ol><h3><strong>Progress</strong></h3><p><strong>Objective 1 (Completed):</strong></p><p>Methodology:</p><ol><li>Create an algorithm using R to collect data on taxi availability from the government portal</li><li>Process and clean the data obtained</li><li>Create a supply heat map using Tableau</li><li>Identify factors which correlate to demand</li></ol><p>Data Source:</p><p>The data for taxi availability used in this project was obtained from w<a href="http://www.data.gov.sg/">ww.data.gov.sg</a> and it contains the co-ordinates of all available taxis which is refreshed every 30 seconds. We collected data over a few days per minute (1440 files per day) and used the 10th(Sunday) and 11th(Monday) of June for visualization as it is able to represent weekdays and weekends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*2J4AQlexXaCFiLJiU7RJhg.png" /><figcaption>Visualization of the taxi availability during 10th June 11pm</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*mg8MWqv0jWAdEoM98JnbvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*4SSk3QzP2NDa6Xi718ER0g.png" /><figcaption>Graph of the amount of available taxis over a weekday and a weekend</figcaption></figure><p>Comparing the graphs of the amount of available taxis over a weekday and a weekend, it can be observed that there is a higher number of available taxis across all time periods and this can be attributed to the higher amount of taxi drivers working during weekdays.</p><p>Next, this project made use of the population distribution in Singapore and the movement of passengers across the EW line as a proxy to identify areas with high demand. However, this can only be achieved by making the assumption that the supply of taxis correlates to its demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQIGZ6eIE2KGujlIQBvXJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VGGAv_iU3KKg3UgBUtXCCA.png" /><figcaption>Heat table for average number of passengers in the EW line (Left) Population distribution in Singapore (Right)</figcaption></figure><p>Comparing these factors to the supply heat map of taxi availability, it was concluded that for most of the areas our hypothesis holds true that the higher the number of passengers or the higher the residential population, the higher the demand of taxis. However, there were a few areas such as the Jurong area which does not fall into this correlation. Hence, we can conclude that this may be due to either the under-supply of taxis or the proxy used is inaccurate. Yet, a concrete conclusion cannot be made due to the lack of data.</p><p><strong>Objective 2 (Completed):</strong></p><p>Dijkstra’s algorithm: An algorithm to find the shortest path in a weighted graph by creating a tree of shortest paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QpneAcMybJTvKw--za6V0g.png" /><figcaption>An example of a weighted graph</figcaption></figure><p><strong>Definition of variables used in the algorithm:</strong></p><p>Vertices denoted as <em>u</em> or <em>v</em></p><p>Weighted edges that connect 2 nodes; <em>(u,v)</em> denotes an edge &amp; <em>w(u,v)</em> denotes its weight</p><p><strong>Initialization:</strong></p><p><em>dist</em> → an array of distances from source node A to other nodes in the graph</p><p>At the start of the program,</p><p><em>dist(A) = 0</em></p><p>All other nodes <em>v, dist(v) = </em>∞</p><p><em>Q</em> → a set of all nodes in the graph (at the end, Q will be empty)</p><p><em>S</em> →an empty set which indicates which nodes have been visited (at the end, S will contain all nodes)</p><p><strong>Algorithm</strong></p><p>While <em>Q </em>is not empty, pope the nod <em>v</em></p><p>→ Which is not in <em>S</em></p><p>→ Smallest <em>dist(v)</em></p><p>Add node <em>v</em> to <em>S </em>to indicate it has been visited</p><p>Update each adjacent node <em>u</em> of the current node <em>v </em>as such:</p><p>→ If <em>dist(v)</em> + <em>w(u,v) </em>&lt; <em>dist(u)</em> , update <em>dist(u) </em>to new minimal distance</p><p>→Otherwise, no updates</p><p>Methodology:</p><ol><li>Download the Singapore map from open street map</li><li>Identify all roads in Singapore from the map</li><li>Use geosphere to calculate the distances of the roads</li><li>Apply Dijkstra’s algorithm on the map</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0qNvKjdfi46qSKddRUaaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sa2x-lFFAO1Sj0x6BRbpCw.png" /><figcaption>Dijkstra’s algorithm implemented in R (Left) Google maps (Right)</figcaption></figure><p>We input 2 values into the Dijkstra’s algorithm, the start point (103.818, 1.3575) and the end point (103.8375, 1.3750) and the results of the program was 2660.855m. Comparing this value to Google Maps whereby the results was 2900.000m, it was concluded that the Dijkstra’s algorithm is rather accurate.</p><p><strong>Objective 3 (In progress):</strong></p><p>Methodology:</p><ol><li>Set up many points in Singapore with a fixed radius to separate Singapore into multiple regions i.e. 500m</li><li>Record average number of taxis in the area based on our data</li><li>Compare the number of available taxis with the average number to determine whether there is an oversupply or under-supply</li><li>Utilize Dijkstra’s algorithm to allocate the oversupply of taxis to the nearest place with an under-supply</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=644cbac2813d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/an-optimization-of-taxi-services-in-singapore-through-data-analysis-644cbac2813d">An optimization of taxi services in Singapore through data analysis by Team 1</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reflection on Challenges by Team 1]]></title>
            <link>https://medium.com/budding-data-scientists/team-1-blog-post-1-dec583ba22a?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/dec583ba22a</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[reflections]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Mon, 28 May 2018 02:05:57 GMT</pubDate>
            <atom:updated>2018-07-28T11:52:13.498Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Tin En Hao 4S326 (Leader), Justin Tan 4S2, Yeoh Yong Jie 4S1</em></p><p>Taking up this project was essentially a leap into the unknown as we had no experience in the field of data science.</p><p>We encountered several challenges:</p><ul><li>Choosing a topic. As we were choosing a topic we had lots of ideas, but we realized that not all the data we require is available upon conducting a search online. Thus we spent a lot of time researching and discussing. We also approached a non-profit organisation that is interested in exploring data analytics for its marketing/ operations. However, we had to change our topic as the data they had collected was insufficient before any analysis could be done.</li><li>Data collection. Even after we’d found our data source, we faced the challenge of mining the data as our data source refreshes the data every 30 seconds and we had to think of a method to auto download the data.</li><li>Data cleaning. The process of cleaning and processing the data was also very challenging as the data came in file types which were unfamiliar to us and came in large amounts. Thus we had a hard time processing and cleaning the data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*9RRqLXKWwg_yIYkA.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dec583ba22a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/team-1-blog-post-1-dec583ba22a">Reflection on Challenges by Team 1</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Homework #5-Tin En Hao]]></title>
            <link>https://medium.com/budding-data-scientists/homework-5-tin-en-hao-b64232c1f70e?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/b64232c1f70e</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Fri, 09 Mar 2018 12:13:34 GMT</pubDate>
            <atom:updated>2018-07-06T07:37:05.312Z</atom:updated>
            <content:encoded><![CDATA[<pre>data = []<br>count = 0<br>for i in titles: <br> count +=1<br> name = i.text.strip()<br> nextsite = ‘<a href="http://www.imdb.com&/#39;">http://www.imdb.com&#39;</a> + i.a[‘href’]<br> hdr = {‘User-Agent’: ‘Mozilla/5.0’}<br> onebookpage = requests.get(nextsite)<br> onesoup = BeautifulSoup(onebookpage.text, “html.parser”)<br> soup = BeautifulSoup(bookpage.text, “html.parser”)<br> try: <br> Titles= titles[i].text.strip()<br> except:<br> Titles=”NA”<br> try:<br> rank = onesoup.find(‘div’, class_ = “titleReviewBar”)<br> except: <br> rank = “NA”<br> try:<br> rating=onesoup.find(itemprop=”ratingValue”).get_text().strip()<br> except:<br> rating = “NA”<br> try:<br> advisory = onesoup.find(‘span’, itemprop=”contentRating”).get_text().strip()<br> except:<br> advisory = “NA”<br> try:<br> runtime = onesoup.find(itemprop=”duration”).get_text().strip()<br> except:<br> runtime = “NA”<br> try:<br> genre=onesoup.find(itemprop=”genre”).get_text().strip()<br> except:<br> genre = “NA”<br> try:<br> Date = onesoup.find(title=”See more release dates”).get_text().strip()<br> except:<br> Date = “NA”<br> data.append((Titles, rating, rank, advisory, runtime, genre, Date)) <br>print(count)<br>time.sleep(1)</pre><p>Possible analysis:</p><ul><li>Relationship between ratings and advisory</li><li>Relationship between runtime and genre</li><li>Relationship between ratings and genre</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b64232c1f70e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/homework-5-tin-en-hao-b64232c1f70e">Homework #5-Tin En Hao</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Homework #2-Tin En Hao]]></title>
            <link>https://medium.com/budding-data-scientists/list-of-united-states-hurricanes-dc4382a3830?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc4382a3830</guid>
            <category><![CDATA[trend-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Tue, 06 Mar 2018 10:12:18 GMT</pubDate>
            <atom:updated>2018-07-06T07:00:52.407Z</atom:updated>
            <content:encoded><![CDATA[<h4>List of United States hurricanes</h4><p><a href="https://en.wikipedia.org/wiki/List_of_United_States_hurricanes">List of United States hurricanes - Wikipedia</a></p><p>Extracted on: 6/03/2018</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*p_n_gehXHrjPT7CHxGuLNw.png" /></figure><p>Conclusions:</p><ol><li>There is a sharp decrease in the number of storms affecting the USA in from 2001 to 2010.</li><li>The number of storms affecting the USA per 10 years fluctuates around the value from 15 -20.</li><li>From 1850 to 2010, USA was hit by storms on an average of approximately twice a year.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc4382a3830" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/list-of-united-states-hurricanes-dc4382a3830">Homework #2-Tin En Hao</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Homework #1-Tin En Hao]]></title>
            <link>https://medium.com/budding-data-scientists/homework-1-tin-en-hao-75f43bd401c4?source=rss-7cf182518748------2</link>
            <guid isPermaLink="false">https://medium.com/p/75f43bd401c4</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[assignment]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Tin En Hao]]></dc:creator>
            <pubDate>Mon, 05 Mar 2018 05:03:06 GMT</pubDate>
            <atom:updated>2018-07-06T06:34:28.251Z</atom:updated>
            <content:encoded><![CDATA[<p>3 Things I learnt today:</p><p>I learnt different methods/types of tests/terms (T test, Z Test, Chi Squared test, null hypothesis)to compare various sets of data depending on the variables. I also learnt the basics of using the R language to analyze data. I have also learnt the various uses of data science and the impact it can have on society.</p><p>1 Question I still have:</p><p>What is the difference between R and python. What are the advantages or disadvantages of both languages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75f43bd401c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/budding-data-scientists/homework-1-tin-en-hao-75f43bd401c4">Homework #1-Tin En Hao</a> was originally published in <a href="https://medium.com/budding-data-scientists">Budding Data Scientists</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>