-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
June Elle Tanedo
committed
Aug 29, 2023
1 parent
073c6f5
commit 606db55
Showing
1 changed file
with
272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,272 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "15568cc0-be91-49e5-9a8c-1030cc298650", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"# Take Home Exam: Mobility Index Calculation and Profiling" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "94ccdd38", | ||
"metadata": {}, | ||
"source": [ | ||
"## 1. Create \"Mobility Index\" and \"Mobility Class\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b74fd38c", | ||
"metadata": {}, | ||
"source": [ | ||
"Using the the following features/indicators:<br>\n", | ||
"<br>\n", | ||
" 1. Total Distance Traveled<br>\n", | ||
" 2. Radius of Gyration<br>\n", | ||
" 3. Activity Entropy<br>\n", | ||
" \n", | ||
"Create a calculated feature called **Mobility Index** (type: decimal/float) and **Mobility Class** (which is are categorized as Low, Mid, and High) for each subscriber.<br>\n", | ||
"Team is free to use any methods or technique to arrive at the **OPTIMAL** Mobility Index and Mobility Class as long as it is supported by literature/s.<br>\n", | ||
"<br>\n", | ||
"**Deadline of the submission is September 1, 2023.** <br>\n", | ||
"<br>\n", | ||
"<br>\n", | ||
"**Criteria for scoring**<br>\n", | ||
"1. Creation of mobility index - 30 pts <br>\n", | ||
"2. Soundness of mobility class - 50 pts <br>\n", | ||
"3. Efficiency of process - 20 pts <br>\n", | ||
" Total -100 pts \n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "835e89f7", | ||
"metadata": {}, | ||
"source": [ | ||
"## 2. Example of Mobility Index" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "1cfd98fc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import random\n", | ||
"import shapely\n", | ||
"import pendulum\n", | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"from scipy import stats\n", | ||
"pd.options.display.max_rows=200\n", | ||
"import geopandas as gpd\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"from IPython.display import HTML, display\n", | ||
"from functools import reduce\n", | ||
"import pyproj\n", | ||
"from functools import partial" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "238621ee", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Sample ABT" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "91355f76", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>Unnamed: 0</th>\n", | ||
" <th>sub_uid</th>\n", | ||
" <th>gender</th>\n", | ||
" <th>age</th>\n", | ||
" <th>name</th>\n", | ||
" <th>chi_indicator</th>\n", | ||
" <th>ewallet_user_indicator</th>\n", | ||
" <th>total_travel_distance</th>\n", | ||
" <th>radius_of_gyration</th>\n", | ||
" <th>activity_entropy</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>78</th>\n", | ||
" <td>78</td>\n", | ||
" <td>glo-sub-030</td>\n", | ||
" <td>male</td>\n", | ||
" <td>36</td>\n", | ||
" <td>Gerald Harrison</td>\n", | ||
" <td>False</td>\n", | ||
" <td>N</td>\n", | ||
" <td>298711.609702</td>\n", | ||
" <td>2345.886941</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>0</td>\n", | ||
" <td>glo-sub-059</td>\n", | ||
" <td>female</td>\n", | ||
" <td>19</td>\n", | ||
" <td>Leslie Mccall</td>\n", | ||
" <td>False</td>\n", | ||
" <td>N</td>\n", | ||
" <td>91618.337212</td>\n", | ||
" <td>1029.615314</td>\n", | ||
" <td>1.061794</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>5</th>\n", | ||
" <td>5</td>\n", | ||
" <td>glo-sub-016</td>\n", | ||
" <td>female</td>\n", | ||
" <td>38</td>\n", | ||
" <td>Sabrina Mclaughlin</td>\n", | ||
" <td>True</td>\n", | ||
" <td>Y</td>\n", | ||
" <td>131249.837053</td>\n", | ||
" <td>1001.024076</td>\n", | ||
" <td>0.859135</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>47</th>\n", | ||
" <td>47</td>\n", | ||
" <td>glo-sub-081</td>\n", | ||
" <td>female</td>\n", | ||
" <td>48</td>\n", | ||
" <td>Jessica Wood</td>\n", | ||
" <td>True</td>\n", | ||
" <td>Y</td>\n", | ||
" <td>233595.159933</td>\n", | ||
" <td>2817.385939</td>\n", | ||
" <td>1.448455</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>44</th>\n", | ||
" <td>44</td>\n", | ||
" <td>glo-sub-054</td>\n", | ||
" <td>male</td>\n", | ||
" <td>25</td>\n", | ||
" <td>Kelly Medina</td>\n", | ||
" <td>True</td>\n", | ||
" <td>Y</td>\n", | ||
" <td>227598.186011</td>\n", | ||
" <td>1852.066940</td>\n", | ||
" <td>0.975380</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>43</th>\n", | ||
" <td>43</td>\n", | ||
" <td>glo-sub-087</td>\n", | ||
" <td>male</td>\n", | ||
" <td>39</td>\n", | ||
" <td>Ryan Morris</td>\n", | ||
" <td>False</td>\n", | ||
" <td>N</td>\n", | ||
" <td>223710.515056</td>\n", | ||
" <td>1755.474028</td>\n", | ||
" <td>1.052595</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" Unnamed: 0 sub_uid gender age name chi_indicator \\\n", | ||
"78 78 glo-sub-030 male 36 Gerald Harrison False \n", | ||
"0 0 glo-sub-059 female 19 Leslie Mccall False \n", | ||
"5 5 glo-sub-016 female 38 Sabrina Mclaughlin True \n", | ||
"47 47 glo-sub-081 female 48 Jessica Wood True \n", | ||
"44 44 glo-sub-054 male 25 Kelly Medina True \n", | ||
"43 43 glo-sub-087 male 39 Ryan Morris False \n", | ||
"\n", | ||
" ewallet_user_indicator total_travel_distance radius_of_gyration \\\n", | ||
"78 N 298711.609702 2345.886941 \n", | ||
"0 N 91618.337212 1029.615314 \n", | ||
"5 Y 131249.837053 1001.024076 \n", | ||
"47 Y 233595.159933 2817.385939 \n", | ||
"44 Y 227598.186011 1852.066940 \n", | ||
"43 N 223710.515056 1755.474028 \n", | ||
"\n", | ||
" activity_entropy \n", | ||
"78 NaN \n", | ||
"0 1.061794 \n", | ||
"5 0.859135 \n", | ||
"47 1.448455 \n", | ||
"44 0.975380 \n", | ||
"43 1.052595 " | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"file_path_sample_data = \"C:/Users/10012425/Desktop/sds4gdsp/scoring_base.csv\"\n", | ||
"ABT_mobility = pd.read_csv(file_path_sample_data)\n", | ||
"ABT_mobility.sample(6)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a7d0bdd7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.8.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |