Skip to content

Commit

Permalink
Merge pull request #3 from jpacil0/jetanedo
Browse files Browse the repository at this point in the history
Correct manual file path
  • Loading branch information
jpacilo authored Aug 29, 2023
2 parents 2a9f1fa + 72f4055 commit ca3b4d3
Show file tree
Hide file tree
Showing 6 changed files with 6,531 additions and 2 deletions.
251 changes: 249 additions & 2 deletions notebooks/03 Take Home Exam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,255 @@
"tags": []
},
"source": [
"# Take Home Exam: Lorem Ipsum"
"# 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: <br>\n",
"<br>\n",
"\n",
"**1. Mobility Index** (type: decimal/float) <br>\n",
"and <br> \n",
"**2. Mobility Class** (which is are categorized as Low, Mid, and High) for each subscriber.<br>\n",
"\n",
"Team is free to use any methods or technique to arrive at the 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",
"\n",
"**Criteria for scoring** <br>\n",
"\n",
"**1. Relevance of Literature (25%)** - Thorough literature review that demonstrates a deep understanding of mobility indices and classes. Wide range of high-quality sources used. <br>\n",
"**2. Conceptual Clarity and Indicator Selection (25%)** - Clear, well-justified conceptual framework. <br>\n",
"**3. Methodology, Data, and Robustness (25%)** - Robust methodology with reliable data sources. <br>\n",
"**4. Interpretability and Usability (15%)** - Detailed explanation of how the index/class can be understood and practically used by various stakeholders. <br>\n",
"<br> \n",
"**Total of 100 pts**"
]
},
{
"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 = \"data/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": "ca6977a1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -27,7 +274,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.17"
"version": "3.8.16"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit ca3b4d3

Please sign in to comment.