aboutsummaryrefslogtreecommitdiff
path: root/notebooks/Lincoln_Business_Clusters_Report.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'notebooks/Lincoln_Business_Clusters_Report.ipynb')
-rw-r--r--notebooks/Lincoln_Business_Clusters_Report.ipynb173
1 files changed, 173 insertions, 0 deletions
diff --git a/notebooks/Lincoln_Business_Clusters_Report.ipynb b/notebooks/Lincoln_Business_Clusters_Report.ipynb
new file mode 100644
index 0000000..09b0039
--- /dev/null
+++ b/notebooks/Lincoln_Business_Clusters_Report.ipynb
@@ -0,0 +1,173 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Capstone Project Report - The Battle of Neighborhoods"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 1. Introduction\n",
+ "\n",
+ "### 1.1 Background\n",
+ "\n",
+ "The purpose of this project is to help investors discover optimal locations for business investment in Lincoln, Nebraska, USA. Many investors know where they want to invest or which business type in which they want to invest, but not many know the different characteristics businesses have across a city such as Lincoln. Lincoln is a growing investment location for many industries, recently being dubbed as part of the \"Silicon Prairie\". However, it is still a small city with ~350,000 citizens. As a result, new investors to the area may need more information before they are able to comfortably invest in a business in Lincoln.\n",
+ "\n",
+ "### 1.2 Business Problem:\n",
+ "\n",
+ "Lincoln is a growing city but the businesses available for investors can vary drastically by location and category. Investors need more information about the business and areas in Lincoln before they can make final decisions.\n",
+ "\n",
+ "### 1.3 Interest\n",
+ "Investors need help when researching new business locations. This project will help demonstrate the number of businesses in different areas of Lincoln, as well as the type of businesses, using the following techniques:\n",
+ "1. Optimally clustered areas of Lincoln businesses.\n",
+ "2. Sorted lists of business types in each cluster."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 2. Data\n",
+ "### 2.1 Data Sources\n",
+ "\n",
+ "I will need data for businesses within Lincoln. To obtain this data, I will use the Foursquare API to fetch the data. Foursquare is a location data provider with information about all manner of venues and events within an area of interest. Such information includes venue names, locations, menus and even photos. As such, the foursquare location platform will be used as the sole data source since all the stated required information can be obtained through the API.\n",
+ "\n",
+ "### 2.2 Data Cleaning\n",
+ "\n",
+ "The Foursquare API returns a set of 100 venues in the search location (per API call), along with many characteristics for each venue. To clean and transform the data, this project will drop all characteristics for each venue, except the following:\n",
+ "1. Venue Name\n",
+ "2. Venue Category\n",
+ "3. Venue Latitude\n",
+ "4. Venue Longitude\n",
+ "\n",
+ "This project also checks for the total number of venues within the search area and reperforms the search multiple times, so that the dataset is not limited to just 100 venues. The search results confirmed that there are 232 venues in this area, so I performed three API calls in order to obtain the complete dataset.\n",
+ "\n",
+ "### 2.3 Feature Selection\n",
+ "\n",
+ "After data cleaning, there were 232 venues listed with four characteristics each (name, category, latitude, longitude). To further explore the data, I decided to group them into clusters to find the optimal number of investment cluster options. To be able to do this, I used the k-means clustering algorithm, which is a form of unsupervised machine learning."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 3. Methodology\n",
+ "\n",
+ "### 3.1 Materials\n",
+ "This project utilizes Python 3.7.6, along with the following libraries:\n",
+ "* Pandas: For creating and manipulating dataframes.\n",
+ "* Folium: Python visualization library would be used to visualize the neighborhoods cluster distribution of using interactive leaflet map.\n",
+ "* Scikit Learn: For importing k-means clustering.\n",
+ "* JSON: Library to handle JSON files.\n",
+ "* Requests: For fetching API results.\n",
+ "* Math: To be able to perform square root functions.\n",
+ "\n",
+ "### 3.2 Design\n",
+ "This project examined a data set of 232 business venues within Lincoln and inspected four variables associated with each business venue:\n",
+ "1. Venue Name\n",
+ "2. Venue Category\n",
+ "3. Venue Latitude\n",
+ "4. Venue Longitude\n",
+ "\n",
+ "This project uses both within-groups or between-groups designs via the k-means clustering algorithm.\n",
+ "\n",
+ "### 3.3 Procedures\n",
+ "1. To being, I defined the latitude, longitude, and zoom variables for Lincoln. I used these variables to create a map of Lincoln using Folium.\n",
+ "2. Next, I utilized the Foursquare API, latitude, and longitude in order to obtain a total number of business venues within Lincoln. This returned 232, so I created three API calls to Foursquare since calls are limited to 100 results each.\n",
+ "3. Then, I created a complete data set by combining all three API results. This data set dropped all columns except the four mentioned in section 3.2.\n",
+ "4. Once the data set is cleaned, I plotted each of the venues on the Folium map using blue markers.\n",
+ "5. To begin clustering, I calculated the 'within clusters sum-of-squares' and used those results to calculate the optimal number of clusters. These functions indicated that this data set should use 6 clusters.\n",
+ "6. I used 6 clusters to fit my data set with k-means clustering. Once the fitting was complete, I appended the cluster numbers (0-5) to each row in the data set.\n",
+ "7. Now that the data set was stratified by cluster number, I plotted the points back onto the Folium map. This time, each cluster was represented by a unique color.\n",
+ "8. In order to provide more descriptive insight into each cluster, I calculated the number of venues in each cluster.\n",
+ "9. Finally, I displayed the venue categories in each cluster which had more than one occurence of that category in its cluster."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 4. Results\n",
+ "\n",
+ "### 4.1 Clustering Results\n",
+ "\n",
+ "The resuls of the k-means clustering algorithm show that there are six unique clusters of businesses in Lincoln. These clusters could also be described by cardinal direction as:\n",
+ "1. Downtown (Blue)\n",
+ "2. South (Red)\n",
+ "3. East (Dark Green)\n",
+ "4. West (Black)\n",
+ "5. North (Pink)\n",
+ "6. Southeast (Purple)\n",
+ "\n",
+ "#### Map of Clusters in Lincoln \n",
+ "![](https://img.cleberg.net/blog/014-ibm-data-science/04_clusters-min.png) \n",
+ "\n",
+ "These clusters closely follow the street layout shown on the map. The clusters with many businesses (0 - 3) are in the most populous areas of Lincoln, while clusters 4 - 5 are in the areas of the city with fewer streets.\n",
+ "\n",
+ "#### Number of Venues by Cluster in Lincoln \n",
+ "![](https://img.cleberg.net/blog/014-ibm-data-science/05_venues_per_cluster-min.png) \n",
+ "\n",
+ "Finally, we can show a deeper inspection of the venues in these clusters. For investors who may want to invest in Mexican restaurants, they would have to decide whether to invest in an area with many Mexican restaurants already (cluster #1) or a cluster with fewer restaurants. Likewise, we can see which areas are more popular for other business categories. \n",
+ "\n",
+ "#### Venue Categories by Clusters in Lincoln (>1) \n",
+ "![](https://img.cleberg.net/blog/014-ibm-data-science/06_categories_per_cluster_pt1-min.png) \n",
+ "![](https://img.cleberg.net/blog/014-ibm-data-science/07_categories_per_cluster_pt2-min.png) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 5. Discussion\n",
+ "\n",
+ "The results of this project show that there are six distinct business areas to consider in Lincoln when determining where to invest. Further, clusters 0 - 3 hold the most venues (Central, East, South, and Southeast), while clusters 4 - 5 have very few venues (North and West). This means that potential investors should look to stay in first four clusters of businesses in Lincoln and avoid the North and West areas. In addition, we found that venues such as Mexican restaurants and Coffee shops currently hold the spots as the most populous businesses. Investors will need to decide if they want to invest in a populous business or take a chance on businesses that do not have a large presence in the city.\n",
+ "\n",
+ "These findings are limited by the data provided by Foursquare. A more conclusive study would utilize multiple data sources for business location data."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 6. Conclusion\n",
+ "\n",
+ "In this project, we gathered location data for Lincoln, Nebraska, USA and clustered the data using the k-means algorithm in order to identify the unique clusters of businesses in Lincoln. Through these actions, we found that there are six unique business clusters in Lincoln and that two of the clusters are likely unsuitable for investors. The remaining four clusters have a variety of businesses, but are largely dominated by restaurants and grocery stores.\n",
+ "\n",
+ "Using this project, investors can now make more informed decisions when deciding the location and category of business in which to invest.\n",
+ "\n",
+ "Further studies may involve other attributes for business locations, such as population density, average wealth across the city, or crime rates. In addition, further studies may include additional location data and businesses by utilizing multiple sources, such as Google Maps and OpenStreetMap."
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.7.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}