From fdff38a38214cf1812735bbbf81d35543c2c447e Mon Sep 17 00:00:00 2001 From: Fletcher Foti Date: Mon, 13 Apr 2015 14:11:14 -0700 Subject: [PATCH 1/3] new cell in the notebook to run with the test data this way can checkout and run with just the test data and don't need the full dataset there was one bug in the school lcm that came up in running the notebook --- .../defaults/models/school_location.py | 9 +- example/configs/settings.yaml | 2 +- example/simulation.ipynb | 1042 ++++++++++------- 3 files changed, 606 insertions(+), 447 deletions(-) diff --git a/activitysim/defaults/models/school_location.py b/activitysim/defaults/models/school_location.py index c98965db3e..e3c8bc4883 100644 --- a/activitysim/defaults/models/school_location.py +++ b/activitysim/defaults/models/school_location.py @@ -48,7 +48,14 @@ def school_location_simulate(set_random_seed, choices_list.append(choices) choices = pd.concat(choices_list) - choices = choices.reindex(persons_merged.index) + + # this fillna is necessary to avoid a downstream crash and might be a bit + # wrong logically. The issue here is that there is a small but non-zero + # chance to choose a school trip even if not of the school type (because + # of -999 rather than outright removal of alternative availability). - + # this fills in the location for those uncommon circumstances, + # so at least it runs + choices = choices.reindex(persons_merged.index).fillna(-1) print "Describe of choices:\n", choices.describe() sim.add_column("persons", "school_taz", choices) diff --git a/example/configs/settings.yaml b/example/configs/settings.yaml index 86498dbf79..6250ec8e54 100644 --- a/example/configs/settings.yaml +++ b/example/configs/settings.yaml @@ -5,7 +5,7 @@ urban_threshold: 4 cbd_threshold: 2 rural_threshold: 6 -households_sample_size: 1000 +households_sample_size: 100 grade_school_max_age: 14 diff --git a/example/simulation.ipynb b/example/simulation.ipynb index 92407439ea..8ab592919b 100644 --- a/example/simulation.ipynb +++ b/example/simulation.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:297e31f6b2b6fcfa9c3e555719a1dd618a184aea8a5231f4cce01c6fa94f72d2" + "signature": "sha256:152ef8dbdb0f3a320097bcb1e85dfbaf7ff1db79dd2c0dd5f0beb089b8b2c5ca" }, "nbformat": 3, "nbformat_minor": 0, @@ -22,6 +22,28 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Run this cell to use the test data which comes with the repo" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import pandas as pd\n", + "import os\n", + "sim.add_injectable(\"store\", pd.HDFStore(\n", + " os.path.join(\"..\", \"activitysim\", \"defaults\", \"test\", \"test.h5\"), \"r\"))" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, { "cell_type": "code", "collapsed": false, @@ -67,21 +89,21 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 2537.000000\n", - "mean 197.994876\n", - "std 395.213046\n", + "count 245.000000\n", + "mean 238.930612\n", + "std 445.364760\n", "min -1.000000\n", "25% -1.000000\n", "50% -1.000000\n", - "75% 117.000000\n", - "max 1450.000000\n", + "75% 69.000000\n", + "max 1434.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'school_location_simulate': 21.20s\n", - "Total time to execute: 21.20s\n" + "Time to execute model 'school_location_simulate': 20.29s\n", + "Total time to execute: 20.29s\n" ] } ], - "prompt_number": 2 + "prompt_number": 3 }, { "cell_type": "code", @@ -112,21 +134,21 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 2537.000000\n", - "mean 330.899488\n", - "std 463.456484\n", - "min -1.000000\n", - "25% -1.000000\n", - "50% -1.000000\n", - "75% 665.000000\n", + "count 245.000000\n", + "mean 875.302041\n", + "std 409.872059\n", + "min 2.000000\n", + "25% 583.000000\n", + "50% 970.000000\n", + "75% 1199.000000\n", "max 1452.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'workplace_location_simulate': 11.85s\n", - "Total time to execute: 11.85s\n" + "Time to execute model 'workplace_location_simulate': 4.51s\n", + "Total time to execute: 4.51s\n" ] } ], - "prompt_number": 3 + "prompt_number": 4 }, { "cell_type": "code", @@ -141,19 +163,19 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 2537.000000\n", - "mean 24.922901\n", - "std 27.613780\n", - "min 0.290000\n", - "25% 2.060000\n", - "50% 14.760000\n", - "75% 44.440000\n", - "max 135.050000\n", + "count 245.000000\n", + "mean 2.074041\n", + "std 1.193102\n", + "min 0.280000\n", + "25% 1.090000\n", + "50% 1.980000\n", + "75% 2.790000\n", + "max 8.880000\n", "dtype: float64\n" ] } ], - "prompt_number": 4 + "prompt_number": 5 }, { "cell_type": "code", @@ -176,26 +198,20 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['@1' 'work_tour_auto_time_savings / (workers+1)']\n", - "Choices:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 407\n", - "1 315\n", - "3 150\n", - "0 93\n", - "4 35\n", + "['@1' \"county_name == 'Napa'\" 'work_tour_auto_time_savings / (workers+1)']\n", + "Choices:\n", + "2 41\n", + "1 36\n", + "3 13\n", + "0 9\n", + "4 1\n", "dtype: int64\n", - "Time to execute model 'auto_ownership_simulate': 0.36s\n", - "Total time to execute: 0.36s\n" + "Time to execute model 'auto_ownership_simulate': 0.25s\n", + "Total time to execute: 0.25s\n" ] } ], - "prompt_number": 5 + "prompt_number": 6 }, { "cell_type": "code", @@ -218,16 +234,16 @@ "output_type": "stream", "stream": "stdout", "text": [ - "Home 980\n", - "NonMandatory 791\n", - "Mandatory 766\n", + "NonMandatory 92\n", + "Home 83\n", + "Mandatory 70\n", "dtype: int64\n", - "Time to execute model 'cdap_simulate': 79.05s\n", - "Total time to execute: 79.05s\n" + "Time to execute model 'cdap_simulate': 5.54s\n", + "Total time to execute: 5.54s\n" ] } ], - "prompt_number": 6 + "prompt_number": 7 }, { "cell_type": "code", @@ -243,7 +259,7 @@ "stream": "stdout", "text": [ "Running model 'mandatory_tour_frequency'\n", - "766 persons run for mandatory tour model" + "70 persons run for mandatory tour model" ] }, { @@ -251,6 +267,15 @@ "stream": "stdout", "text": [ "\n", + "count 70.000000\n", + "mean 840.771429\n", + "std 377.661384\n", + "min 16.000000\n", + "25% 568.000000\n", + "50% 927.500000\n", + "75% 1125.000000\n", + "max 1433.000000\n", + "Name: workplace_taz, dtype: float64\n", "WARNING: Some columns have no variability:\n" ] }, @@ -258,30 +283,41 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(ptype == 4) & (distance_to_work < 3)'\n", - " '(ptype == 5) & (distance_to_work < 3)'\n", + "['(ptype == 3) & female' '(ptype == 6) & female'\n", + " '(ptype == 2) & (age <= 35)' '(ptype == 3) & (age <= 35)'\n", + " '(ptype == 3) & (distance_to_school < 3)'\n", + " '(ptype == 6) & (distance_to_school < 3)'\n", + " '(ptype == 3) & student_is_employed' '(ptype == 6) & student_is_employed'\n", + " '(ptype == 1) & nonstudent_to_school'\n", " '(ptype == 2) & nonstudent_to_school'\n", " '(ptype == 4) & nonstudent_to_school'\n", - " '(ptype == 5) & nonstudent_to_school' '(ptype == 7) & non_family']\n", - "Choices:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "work1 542\n", - "school1 169\n", - "work2 32\n", - "school2 12\n", - "work_and_school 11\n", + " '(ptype == 5) & nonstudent_to_school'\n", + " '(ptype == 1) & (auto_ownership == 0)'\n", + " '(ptype == 2) & (auto_ownership == 0)'\n", + " '(ptype == 3) & (auto_ownership == 0)'\n", + " '(ptype == 6) & (auto_ownership == 0)'\n", + " '(ptype == 7) & (auto_ownership == 0)'\n", + " '(ptype == 3) & (auto_ownership < drivers)'\n", + " '(ptype == 3) * (num_young_children)'\n", + " '(ptype == 5) * (num_young_children)'\n", + " '(ptype == 3) & (income_in_thousands > 50)' '(ptype == 2) & non_family'\n", + " '(ptype == 3) & non_family' '(ptype == 6) & non_family'\n", + " '(ptype == 7) & non_family' '(ptype == 2) & home_is_urban'\n", + " '(ptype == 5) & home_is_urban' '(ptype == 6) & home_is_urban'\n", + " '~(workplace_taz > -1)']\n", + "Choices:\n", + "work1 42\n", + "work2 17\n", + "school1 7\n", + "work_and_school 2\n", + "school2 2\n", "dtype: int64\n", - "Time to execute model 'mandatory_tour_frequency': 2.58s\n", - "Total time to execute: 2.58s\n" + "Time to execute model 'mandatory_tour_frequency': 2.90s\n", + "Total time to execute: 2.90s\n" ] } ], - "prompt_number": 10 + "prompt_number": 8 }, { "cell_type": "code", @@ -295,15 +331,15 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 11, + "prompt_number": 9, "text": [ - "work 617\n", - "school 204\n", + "work 78\n", + "school 13\n", "dtype: int64" ] } ], - "prompt_number": 11 + "prompt_number": 9 }, { "cell_type": "code", @@ -319,7 +355,7 @@ "stream": "stdout", "text": [ "Running model 'mandatory_scheduling'\n", - "Running 821 mandatory tour scheduling choices" + "Running 13 school tour scheduling choices" ] }, { @@ -327,7 +363,7 @@ "stream": "stdout", "text": [ "\n", - "Running 766 #1 tour choices\n", + "Running 11 #1 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -335,17 +371,26 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(start <= end_previous) & (tour_num == 2)' '(tour_num == 2) * start'\n", - " '(tour_num == 2) * duration' 'home_is_rural & (start < 6)'\n", - " 'home_is_rural & (end > 22)' '(tour_num == 2) & (duration < 8)']\n", - "Running 55 #2 tour choices" + "['(ptype == 4) * start' '(ptype == 3) * start' '(ptype == 3) * duration'\n", + " '(workers == hhsize) * duration' '(tour_num > 1) & (start < end_previous)'\n", + " '(tour_num > 1) * duration' '(tour_num > 1) & (duration < 6)'\n", + " 'work_and_school_and_worker & (duration < 6)']\n", + "Running 2 #2 tour choices\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "['(ptype == 1) * start' '(ptype == 1) * duration' '(ptype == 4) * start'\n", + " '(ptype == 3) * start' '(ptype == 3) * duration'\n", + " '(workers == hhsize) * duration' '(tour_num == 1) * start'\n", + " '(tour_num == 1) * duration' '(tour_num == 1) & (duration < 6)'\n", + " 'work_and_school_and_worker & (duration < 6)'\n", + " 'work_and_school_and_student & (duration < 6)']\n", + "Running 78 work tour scheduling choices\n", + "Running 61 #1 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -353,31 +398,45 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(ptype == 4) * duration' '(tour_num == 1) * start'\n", - " '(tour_num == 1) * duration' 'home_is_rural & (start < 6)'\n", - " 'home_is_rural & (end > 22)' '(tour_num == 1) & (duration < 8)']\n", - "Choices:\n" + "['home_is_rural & (start < 6)' 'home_is_rural & (end > 22)'\n", + " \"(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)\"]\n", + "Running 17 #2 tour choices" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "count 821.000000\n", - "mean 169.792935\n", - "std 45.827018\n", + "\n", + "WARNING: Some columns have no variability:\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "['(ptype == 2) * start' '(ptype == 3) * start' '(tour_num == 1) * start'\n", + " '(tour_num == 1) * duration' 'home_is_rural & (start < 6)'\n", + " 'home_is_rural & (end > 22)' '(ptype == 2) & (end > 12) & (end < 16)'\n", + " '(tour_num == 1) & (duration < 8)'\n", + " \"(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)\"\n", + " \"(mandatory_tour_frequency == 'work_and_school') & is_student & (duration < 8)\"]\n", + "Choices:\n", + "count 91.000000\n", + "mean 163.131868\n", + "std 59.405613\n", "min 0.000000\n", - "25% 181.000000\n", + "25% 182.000000\n", "50% 187.000000\n", - "75% 188.000000\n", + "75% 189.000000\n", "max 189.000000\n", "dtype: float64\n", - "Time to execute model 'mandatory_scheduling': 5.90s\n", - "Total time to execute: 5.90s\n" + "Time to execute model 'mandatory_scheduling': 3.31s\n", + "Total time to execute: 3.31s\n" ] } ], - "prompt_number": 12 + "prompt_number": 10 }, { "cell_type": "code", @@ -393,7 +452,7 @@ "stream": "stdout", "text": [ "Running model 'non_mandatory_tour_frequency'\n", - "1557 persons run for non-mandatory tour model" + "162 persons run for non-mandatory tour model" ] }, { @@ -401,7 +460,7 @@ "stream": "stdout", "text": [ "\n", - "Running segment 'driving' of size 42\n", + "Running segment 'driving' of size 4\n", "WARNING: Some columns have no variability:\n" ] }, @@ -416,24 +475,37 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", + " '(100 < income_in_thousands) & (tot_tours == 1)'\n", + " '(100 < income_in_thousands) & (tot_tours == 2)'\n", + " '(100 < income_in_thousands) & (tot_tours == 3)'\n", + " '(100 < income_in_thousands) & (tot_tours == 4)'\n", + " '(100 < income_in_thousands) & (tot_tours > 4)'\n", + " '(100 < income_in_thousands) * shopping'\n", + " '(100 < income_in_thousands) * othmaint'\n", + " '(100 < income_in_thousands) * eatout'\n", + " '(100 < income_in_thousands) * othdiscr'\n", + " '(100 < income_in_thousands) * social' 'no_cars & (tot_tours == 1)'\n", + " 'no_cars & (tot_tours == 2)' 'no_cars & (tot_tours == 3)'\n", + " 'no_cars & (tot_tours == 4)' 'no_cars & (tot_tours > 4)'\n", " '(car_sufficiency > 0) & (tot_tours == 1)'\n", " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", + " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", + " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", + " 'has_retiree * escort' 'has_driving_kid * escort'\n", " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", + " 'has_retiree * shopping' 'has_driving_kid * shopping'\n", " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", + " 'has_retiree * othmaint' 'has_driving_kid * othmaint'\n", " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", + " 'has_retiree * eatout' 'has_driving_kid * eatout'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'full' of size 543" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", + " 'has_retiree * othdiscr' 'has_driving_kid * othdiscr'\n", + " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'\n", + " 'escort * no_cars']\n", + "Running segment 'full' of size 47\n", "WARNING: Some columns have no variability:\n" ] }, @@ -453,7 +525,7 @@ " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'nonwork' of size 279" + "Running segment 'nonwork' of size 40" ] }, { @@ -480,7 +552,7 @@ " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'part' of size 129" + "Running segment 'part' of size 10" ] }, { @@ -502,19 +574,24 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", - " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'preschool' of size 115" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", + " 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'\n", + " 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'\n", + " 'no_cars & (tot_tours > 4)' '(car_sufficiency > 0) & (tot_tours == 1)'\n", + " '(car_sufficiency > 0) & (tot_tours == 2)'\n", + " '(car_sufficiency > 0) & (tot_tours == 3)'\n", + " '(car_sufficiency > 0) & (tot_tours == 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_part_time * escort'\n", + " 'has_university * escort' 'has_school_kid_at_home * escort'\n", + " 'has_preschool_kid_at_home * escort' 'has_part_time * shopping'\n", + " 'has_university * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_part_time * othmaint'\n", + " 'has_university * othmaint' 'has_school_kid_at_home * othmaint'\n", + " 'has_preschool_kid_at_home * othmaint' 'has_part_time * eatout'\n", + " 'has_university * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_part_time * othdiscr'\n", + " 'has_university * othdiscr' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr' 'escort * no_cars']\n", + "Running segment 'preschool' of size 13\n", "WARNING: Some columns have no variability:\n" ] }, @@ -529,24 +606,27 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " '(car_sufficiency > 0) & (tot_tours == 1)'\n", + " 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'\n", + " 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'\n", + " 'no_cars & (tot_tours > 4)' '(car_sufficiency > 0) & (tot_tours == 1)'\n", " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", + " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", + " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", + " 'has_retiree * escort' 'has_university * escort'\n", " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", + " 'has_retiree * shopping' 'has_university * shopping'\n", " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", + " 'has_retiree * othmaint' 'has_university * othmaint'\n", " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", + " 'has_retiree * eatout' 'has_university * eatout'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'retired' of size 180" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", + " 'has_retiree * othdiscr' 'has_university * othdiscr'\n", + " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'\n", + " 'escort * no_cars']\n", + "Running segment 'retired' of size 18\n", "WARNING: Some columns have no variability:\n" ] }, @@ -561,19 +641,27 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", - " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'school' of size 197" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", + " '(car_sufficiency > 0) & (tot_tours == 1)'\n", + " '(car_sufficiency > 0) & (tot_tours == 2)'\n", + " '(car_sufficiency > 0) & (tot_tours == 3)'\n", + " '(car_sufficiency > 0) & (tot_tours == 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)'\n", + " 'has_preschool_kid & (tot_tours == 1)'\n", + " 'has_preschool_kid & (tot_tours == 2)'\n", + " 'has_preschool_kid & (tot_tours == 3)'\n", + " 'has_preschool_kid & (tot_tours == 4)'\n", + " 'has_preschool_kid & (tot_tours == 5)' 'has_university * escort'\n", + " 'has_preschool_kid * escort' 'has_school_kid_at_home * escort'\n", + " 'has_preschool_kid_at_home * escort' 'has_university * shopping'\n", + " 'has_preschool_kid * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_university * othmaint'\n", + " 'has_preschool_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", + " 'has_preschool_kid_at_home * othmaint' 'has_university * eatout'\n", + " 'has_preschool_kid * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_university * othdiscr'\n", + " 'has_preschool_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr']\n", + "Running segment 'school' of size 23\n", "WARNING: Some columns have no variability:\n" ] }, @@ -588,12 +676,17 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", + " '(car_sufficiency > 0) & (tot_tours == 1)'\n", + " '(car_sufficiency > 0) & (tot_tours == 2)'\n", + " '(car_sufficiency > 0) & (tot_tours == 3)'\n", + " '(car_sufficiency > 0) & (tot_tours == 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)'\n", " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'university' of size 72" + "Running segment 'university' of size 7" ] }, { @@ -619,76 +712,57 @@ " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)'\n", - " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", - " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Choices:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "0 761\n", - "16 179\n", - "1 131\n", - "8 95\n", - "32 76\n", - "4 65\n", - "2 47\n", - "64 25\n", - "17 23\n", - "24 18\n", - "20 11\n", - "5 11\n", - "40 10\n", - "9 9\n", - "36 8\n", - "33 8\n", - "80 7\n", - "48 7\n", - "12 5\n", - "10 5\n", - "49 4\n", - "6 4\n", - "18 4\n", - "3 3\n", - "65 3\n", - "21 3\n", - "44 3\n", - "34 3\n", - "41 2\n", - "25 2\n", - "72 2\n", - "57 2\n", - "52 2\n", - "13 2\n", - "66 2\n", - "7 1\n", - "74 1\n", - "11 1\n", - "67 1\n", - "69 1\n", - "22 1\n", - "29 1\n", - "76 1\n", - "35 1\n", - "37 1\n", - "51 1\n", - "53 1\n", - "56 1\n", - "60 1\n", - "26 1\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", + " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", + " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", + " 'has_preschool_kid & (tot_tours == 1)'\n", + " 'has_preschool_kid & (tot_tours == 2)'\n", + " 'has_preschool_kid & (tot_tours == 3)'\n", + " 'has_preschool_kid & (tot_tours == 4)'\n", + " 'has_preschool_kid & (tot_tours == 5)' 'has_part_time * escort'\n", + " 'has_retiree * escort' 'has_university * escort'\n", + " 'has_preschool_kid * escort' 'has_school_kid_at_home * escort'\n", + " 'has_preschool_kid_at_home * escort' 'has_part_time * shopping'\n", + " 'has_retiree * shopping' 'has_university * shopping'\n", + " 'has_preschool_kid * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_part_time * othmaint'\n", + " 'has_retiree * othmaint' 'has_university * othmaint'\n", + " 'has_preschool_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", + " 'has_preschool_kid_at_home * othmaint' 'has_part_time * eatout'\n", + " 'has_retiree * eatout' 'has_university * eatout'\n", + " 'has_preschool_kid * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_part_time * othdiscr'\n", + " 'has_retiree * othdiscr' 'has_university * othdiscr'\n", + " 'has_preschool_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr']\n", + "Choices:\n", + "0 70\n", + "16 23\n", + "1 16\n", + "32 11\n", + "8 11\n", + "4 7\n", + "2 5\n", + "17 4\n", + "13 2\n", + "9 2\n", + "10 2\n", + "12 1\n", + "80 1\n", + "68 1\n", + "82 1\n", + "18 1\n", + "20 1\n", + "33 1\n", + "40 1\n", + "88 1\n", "dtype: int64\n", - "Time to execute model 'non_mandatory_tour_frequency': 16.53s\n", - "Total time to execute: 16.53s\n" + "Time to execute model 'non_mandatory_tour_frequency': 9.15s\n", + "Total time to execute: 9.15s\n" ] } ], - "prompt_number": 13 + "prompt_number": 11 }, { "cell_type": "code", @@ -702,19 +776,19 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 14, - "text": [ - "shopping 269\n", - "escort 217\n", - "othdiscr 212\n", - "othmaint 162\n", - "eatout 122\n", - "social 76\n", + "prompt_number": 12, + "text": [ + "shopping 32\n", + "othdiscr 25\n", + "escort 21\n", + "othmaint 20\n", + "eatout 12\n", + "social 9\n", "dtype: int64" ] } ], - "prompt_number": 14 + "prompt_number": 12 }, { "cell_type": "code", @@ -730,7 +804,17 @@ "stream": "stdout", "text": [ "Running model 'destination_choice'\n", - "Running segment 'eatout' of size 122" + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "eatout\n", + "Running segment 'eatout' of size 12\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" ] }, { @@ -738,7 +822,9 @@ "stream": "stdout", "text": [ "\n", - "Running segment 'othdiscr' of size 212" + "shopping\n", + "Running segment 'shopping' of size 21\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" ] }, { @@ -746,7 +832,9 @@ "stream": "stdout", "text": [ "\n", - "Running segment 'othmaint' of size 162" + "othdiscr\n", + "Running segment 'othdiscr' of size 25\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" ] }, { @@ -754,7 +842,9 @@ "stream": "stdout", "text": [ "\n", - "Running segment 'shopping' of size 269" + "othmaint\n", + "Running segment 'othmaint' of size 20\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" ] }, { @@ -762,7 +852,9 @@ "stream": "stdout", "text": [ "\n", - "Running segment 'social' of size 76" + "shopping\n", + "Running segment 'shopping' of size 32\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" ] }, { @@ -770,6 +862,8 @@ "stream": "stdout", "text": [ "\n", + "social\n", + "Running segment 'social' of size 9\n", "Choices:\n" ] }, @@ -777,21 +871,21 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 841.000000\n", - "mean 728.715815\n", - "std 419.654156\n", - "min 2.000000\n", - "25% 400.000000\n", - "50% 733.000000\n", - "75% 1122.000000\n", - "max 1450.000000\n", + "count 119.000000\n", + "mean 803.058824\n", + "std 427.918282\n", + "min 4.000000\n", + "25% 469.500000\n", + "50% 947.000000\n", + "75% 1166.500000\n", + "max 1441.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'destination_choice': 7.73s\n", - "Total time to execute: 7.73s\n" + "Time to execute model 'destination_choice': 3.45s\n", + "Total time to execute: 3.45s\n" ] } ], - "prompt_number": 15 + "prompt_number": 13 }, { "cell_type": "code", @@ -807,7 +901,7 @@ "stream": "stdout", "text": [ "Running model 'non_mandatory_scheduling'\n", - "Running 1058 non-mandatory tour scheduling choices" + "Running 119 non-mandatory tour scheduling choices" ] }, { @@ -815,7 +909,7 @@ "stream": "stdout", "text": [ "\n", - "Running 796 #1 tour choices\n", + "Running 92 #1 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -823,8 +917,13 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(tour_type == \"oth_maint\") * start']\n", - "Running 203 #2 tour choices" + "['(start <= end_previous) & (tour_num > 1)'\n", + " '(tour_type == \"oth_maint\") * start'\n", + " '(tour_type == \"oth_maint\") * duration' 'num_mand * start'\n", + " 'num_joint_tours * start' '(tour_num > 1) * duration'\n", + " '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(tour_type == \"othdisc\") & (duration < 2)']\n", + "Running 19 #2 tour choices" ] }, { @@ -839,8 +938,17 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(tour_type == \"oth_maint\") * start']\n", - "Running 49 #3 tour choices\n", + "['(tour_type == \"shopping\") * start' '(tour_type == \"shopping\") * duration'\n", + " '(tour_type == \"oth_maint\") * start'\n", + " '(tour_type == \"oth_maint\") * duration' '(ptype == 6) * start'\n", + " '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'\n", + " 'num_mand * start' 'num_joint_tours * start' '(tour_num == 1) * start'\n", + " '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(tour_type == \"shopping\") & (start < 8)'\n", + " '(tour_type == \"shopping\") & (end > 22)' '(ptype == 7) & (end > 22)'\n", + " '(tour_type == \"shopping\") & (duration < 2)'\n", + " '(tour_type == \"othdisc\") & (duration < 2)']\n", + "Running 6 #3 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -848,8 +956,42 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(tour_type == \"oth_maint\") * start']\n", - "Running 10 #4 tour choices\n", + "['(tour_type == \"oth_maint\") * start'\n", + " '(tour_type == \"oth_maint\") * duration' '(tour_type == \"social\") * start'\n", + " '(tour_type == \"social\") * duration' '(ptype == 6) * start'\n", + " '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'\n", + " 'destination_in_cbd * duration' 'num_mand * start'\n", + " 'num_joint_tours * start' '(tour_num == 1) * start'\n", + " '(tour_type == \"oth_maint\") & (start < 7)' '(ptype == 7) & (end > 22)'\n", + " '(tour_type == \"othdisc\") & (duration < 2)'\n", + " '(tour_type == \"escort\") & (start < 6)'\n", + " '(tour_type == \"escort\") & (start == 6)'\n", + " '(tour_type == \"escort\") & (start == 7)'\n", + " '(tour_type == \"escort\") & (start == 8)'\n", + " '(tour_type == \"escort\") & (start == 9)'\n", + " '(tour_type == \"escort\") & (start > 9) & (start < 13)'\n", + " '(tour_type == \"escort\") & (start > 12) & (start < 16)'\n", + " '(tour_type == \"escort\") & (start > 15) & (start < 19)'\n", + " '(tour_type == \"escort\") & (start > 18) & (start < 22)'\n", + " '(tour_type == \"escort\") & (start > 21)'\n", + " '(tour_type == \"escort\") & (end < 7)'\n", + " '(tour_type == \"escort\") & (end > 6) & (end < 10)'\n", + " '(tour_type == \"escort\") & (end > 9) & (end < 13)'\n", + " '(tour_type == \"escort\") & (end > 12) & (end < 15)'\n", + " '(tour_type == \"escort\") & (end == 15)'\n", + " '(tour_type == \"escort\") & (end == 16)'\n", + " '(tour_type == \"escort\") & (end == 17)'\n", + " '(tour_type == \"escort\") & (end == 18)'\n", + " '(tour_type == \"escort\") & (end > 18) & (end < 22)'\n", + " '(tour_type == \"escort\") & (end > 21)'\n", + " '(tour_type == \"escort\") & (duration < 2)'\n", + " '(tour_type == \"escort\") & (duration > 1) & (duration < 4)'\n", + " '(tour_type == \"escort\") & (duration > 3) & (duration < 6)'\n", + " '(tour_type == \"escort\") & (duration > 5) & (duration < 8)'\n", + " '(tour_type == \"escort\") & (duration > 7) & (duration < 11)'\n", + " '(tour_type == \"escort\") & (duration > 10) & (duration < 14)'\n", + " '(tour_type == \"escort\") & (duration > 13) & (duration < 19)']\n", + "Running 2 #4 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -858,23 +1000,59 @@ "stream": "stdout", "text": [ "['(tour_type == \"shopping\") * start' '(tour_type == \"shopping\") * duration'\n", - " '(tour_type == \"oth_maint\") * start']\n", + " '(tour_type == \"oth_maint\") * start'\n", + " '(tour_type == \"oth_maint\") * duration' '(tour_type == \"eatout\") * start'\n", + " '(ptype == 6) * start' '(ptype == 6) * duration' '(ptype == 7) * start'\n", + " '(ptype == 7) * duration' 'destination_in_cbd * duration'\n", + " 'num_mand * start' 'num_joint_tours * start' '(tour_num == 1) * start'\n", + " '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(tour_type == \"shopping\") & (start < 8)'\n", + " '(tour_type == \"shopping\") & (end > 22)' '(ptype == 7) & (end > 22)'\n", + " '(ptype == 3) & (end > 22)' '(tour_type == \"shopping\") & (duration < 2)'\n", + " '(tour_type == \"othdisc\") & (duration < 2)'\n", + " '(tour_type == \"escort\") & (start < 6)'\n", + " '(tour_type == \"escort\") & (start == 6)'\n", + " '(tour_type == \"escort\") & (start == 7)'\n", + " '(tour_type == \"escort\") & (start == 8)'\n", + " '(tour_type == \"escort\") & (start == 9)'\n", + " '(tour_type == \"escort\") & (start > 9) & (start < 13)'\n", + " '(tour_type == \"escort\") & (start > 12) & (start < 16)'\n", + " '(tour_type == \"escort\") & (start > 15) & (start < 19)'\n", + " '(tour_type == \"escort\") & (start > 18) & (start < 22)'\n", + " '(tour_type == \"escort\") & (start > 21)'\n", + " '(tour_type == \"escort\") & (end < 7)'\n", + " '(tour_type == \"escort\") & (end > 6) & (end < 10)'\n", + " '(tour_type == \"escort\") & (end > 9) & (end < 13)'\n", + " '(tour_type == \"escort\") & (end > 12) & (end < 15)'\n", + " '(tour_type == \"escort\") & (end == 15)'\n", + " '(tour_type == \"escort\") & (end == 16)'\n", + " '(tour_type == \"escort\") & (end == 17)'\n", + " '(tour_type == \"escort\") & (end == 18)'\n", + " '(tour_type == \"escort\") & (end > 18) & (end < 22)'\n", + " '(tour_type == \"escort\") & (end > 21)'\n", + " '(tour_type == \"escort\") & (duration < 2)'\n", + " '(tour_type == \"escort\") & (duration > 1) & (duration < 4)'\n", + " '(tour_type == \"escort\") & (duration > 3) & (duration < 6)'\n", + " '(tour_type == \"escort\") & (duration > 5) & (duration < 8)'\n", + " '(tour_type == \"escort\") & (duration > 7) & (duration < 11)'\n", + " '(tour_type == \"escort\") & (duration > 10) & (duration < 14)'\n", + " '(tour_type == \"escort\") & (duration > 13) & (duration < 19)']\n", "Choices:\n", - "count 1058.000000\n", - "mean 65.284499\n", - "std 50.422260\n", - "min 0.000000\n", - "25% 18.000000\n", - "50% 52.000000\n", - "75% 96.750000\n", - "max 189.000000\n", + "count 119.000000\n", + "mean 160.117647\n", + "std 66.806599\n", + "min 0.000000\n", + "25% 187.000000\n", + "50% 188.000000\n", + "75% 189.000000\n", + "max 189.000000\n", "dtype: float64\n", - "Time to execute model 'non_mandatory_scheduling': 3.48s\n", - "Total time to execute: 3.48s\n" + "Time to execute model 'non_mandatory_scheduling': 4.70s\n", + "Total time to execute: 4.70s\n" ] } ], - "prompt_number": 17 + "prompt_number": 14 }, { "cell_type": "code", @@ -890,49 +1068,14 @@ "stream": "stdout", "text": [ "Running model 'mode_choice_simulate'\n", - " work\n", - "Expression Alternative \n", - "sov_available == False DRIVEALONEFREE -999.000000\n", - "auto_ownership == 0 DRIVEALONEFREE -999.000000\n", - "age < 16 DRIVEALONEFREE -999.000000\n", - "is_joint DRIVEALONEFREE -999.000000\n", - "work_tour_is_drive DRIVEALONEFREE -999.000000\n", - "@out_skims['SOV_TIME'] + in_skims['SOV_TIME'] DRIVEALONEFREE -0.017500\n", - "2 * terminal_time DRIVEALONEFREE -0.035000\n", - "@costPerMile * (out_skims['SOV_DIST'] + in_skims['SOV_DIST']) DRIVEALONEFREE -0.001313\n", - "daily_parking_cost DRIVEALONEFREE -0.001313\n", - "@out_skims['SOV_BTOLL'] + in_skims['SOV_BTOLL'] DRIVEALONEFREE -0.001313\n", - "age_16_to_19 DRIVEALONEFREE 0.000000\n", - "sovtoll_available == False DRIVEALONEPAY -999.000000\n", - "auto_ownership == 0 DRIVEALONEPAY -999.000000\n", - "age < 16 DRIVEALONEPAY -999.000000\n", - "is_joint DRIVEALONEPAY -999.000000\n", - "work_tour_is_drive DRIVEALONEPAY -999.000000\n", - "@out_skims['SOVTOLL_TIME'] + in_skims['SOVTOLL_TIME'] DRIVEALONEPAY -0.017500\n", - "2 * terminal_time DRIVEALONEPAY -0.035000\n", - "@costPerMile * (out_skims['SOVTOLL_DIST'] + in_skims['SOVTOLL_DIST']) DRIVEALONEPAY -0.001313\n", - "daily_parking_cost DRIVEALONEPAY -0.001313\n", - "@out_skims['SOVTOLL_BTOLL'] + in_skims['SOVTOLL_BTOLL'] DRIVEALONEPAY -0.001313\n", - "@out_skims['SOVTOLL_VTOLL'] + in_skims['SOVTOLL_VTOLL'] DRIVEALONEPAY -0.001313\n", - "age_16_to_19 DRIVEALONEPAY 0.000000\n", - "hov2_available == False SHARED2FREE -999.000000\n", - "is_joint & (number_of_participants > 2) SHARED2FREE -999.000000\n", - "@out_skims['HOV2_TIME'] + in_skims['HOV2_TIME'] SHARED2FREE -0.017500\n", - "2 * terminal_time SHARED2FREE -0.035000\n", - "@costPerMile * (out_skims['HOV2_DIST'] + in_skims['HOV2_DIST']) SHARED2FREE -0.001313\n", - "@df.daily_parking_cost / costShareSr2 SHARED2FREE -0.001313\n", - "@(out_skims['HOV2_BTOLL'] + in_skims['HOV2_BTOLL']) / costShareSr2 SHARED2FREE -0.001313\n", - "hhsize == 1 SHARED2FREE 0.000000\n", - "hhsize == 2 SHARED2FREE 0.000000\n", - "age_16_p SHARED2FREE -1.366000" + "WARNING, skipping key: " ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", - "WARNING, skipping key: DISTANCE\n", + " DISTANCE\n", "WARNING, skipping key: " ] }, @@ -952,23 +1095,17 @@ " 'daily_parking_cost' 'hov2_available == False' 'is_joint'\n", " 'is_joint & (number_of_participants > 2)' 'sov_available == False'\n", " 'sovtoll_available == False' 'work_tour_is_drive']\n", - "Choices:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 711\n", - "0 615\n", - "1 553\n", + "Choices:\n", + "1 28\n", + "2 25\n", + "0 25\n", "dtype: int64\n", - "Time to execute model 'mode_choice_simulate': 5.89s\n", - "Total time to execute: 5.89s\n" + "Time to execute model 'mode_choice_simulate': 4.63s\n", + "Total time to execute: 4.63s\n" ] } ], - "prompt_number": 18 + "prompt_number": 15 }, { "cell_type": "code", @@ -1040,7 +1177,7 @@ ] } ], - "prompt_number": 13 + "prompt_number": 16 }, { "cell_type": "code", @@ -1056,91 +1193,81 @@ "stream": "stdout", "text": [ "\n", - "Int64Index: 1000 entries, 1669190 to 1400683\n", - "Data columns (total 77 columns):\n", - "TAZ 1000 non-null int64\n", - "SERIALNO 1000 non-null int64\n", - "PUMA5 1000 non-null int64\n", - "income 1000 non-null int64\n", - "PERSONS 1000 non-null int64\n", - "HHT 1000 non-null int64\n", - "UNITTYPE 1000 non-null int64\n", - "NOC 1000 non-null int64\n", - "BLDGSZ 1000 non-null int64\n", - "TENURE 1000 non-null int64\n", - "VEHICL 1000 non-null int64\n", - "hinccat1 1000 non-null int64\n", - "hinccat2 1000 non-null int64\n", - "hhagecat 1000 non-null int64\n", - "hsizecat 1000 non-null int64\n", - "hfamily 1000 non-null int64\n", - "hunittype 1000 non-null int64\n", - "hNOCcat 1000 non-null int64\n", - "hwrkrcat 1000 non-null int64\n", - "h0004 1000 non-null int64\n", - "h0511 1000 non-null int64\n", - "h1215 1000 non-null int64\n", - "h1617 1000 non-null int64\n", - "h1824 1000 non-null int64\n", - "h2534 1000 non-null int64\n", - "h3549 1000 non-null int64\n", - "h5064 1000 non-null int64\n", - "h6579 1000 non-null int64\n", - "h80up 1000 non-null int64\n", - "workers 1000 non-null int64\n", - "hwork_f 1000 non-null int64\n", - "hwork_p 1000 non-null int64\n", - "huniv 1000 non-null int64\n", - "hnwork 1000 non-null int64\n", - "hretire 1000 non-null int64\n", - "hpresch 1000 non-null int64\n", - "hschpred 1000 non-null int64\n", - "hschdriv 1000 non-null int64\n", - "htypdwel 1000 non-null int64\n", - "hownrent 1000 non-null int64\n", - "hadnwst 1000 non-null int64\n", - "hadwpst 1000 non-null int64\n", - "hadkids 1000 non-null int64\n", - "bucketBin 1000 non-null int64\n", - "originalPUMA 1000 non-null int64\n", - "hmultiunit 1000 non-null int64\n", - "has_preschool_kid 1000 non-null bool\n", - "family 1000 non-null bool\n", - "num_young_adults 1000 non-null float64\n", - "auto_ownership 1000 non-null int64\n", - "has_driving_kid 1000 non-null bool\n", - "has_preschool_kid_at_home 1000 non-null bool\n", - "home_taz 1000 non-null int64\n", - "has_retiree 1000 non-null bool\n", - "drivers 1000 non-null float64\n", - "hhsize 1000 non-null int64\n", - "num_under16_not_at_school 1000 non-null int64\n", - "has_non_worker 1000 non-null bool\n", - "num_children 1000 non-null float64\n", - "car_sufficiency 1000 non-null int64\n", - "num_adolescents 1000 non-null float64\n", - "income_in_thousands 1000 non-null float64\n", - "has_school_kid 1000 non-null bool\n", - "num_college_age 1000 non-null float64\n", - "non_workers 1000 non-null int64\n", - "household_type 957 non-null object\n", - "home_is_rural 1000 non-null bool\n", - "work_tour_auto_time_savings 1000 non-null int64\n", - "non_family 1000 non-null bool\n", - "has_university 1000 non-null bool\n", - "income_segment 1000 non-null category\n", - "has_full_time 1000 non-null bool\n", - "has_part_time 1000 non-null bool\n", - "has_school_kid_at_home 1000 non-null bool\n", - "no_cars 1000 non-null bool\n", - "num_young_children 1000 non-null float64\n", - "home_is_urban 1000 non-null bool\n", - "dtypes: bool(15), category(1), float64(7), int64(53), object(1)\n", - "memory usage: 500.0 KB\n" + "Int64Index: 100 entries, 1012634 to 1307265\n", + "Data columns (total 67 columns):\n", + "TAZ 100 non-null int64\n", + "SERIALNO 100 non-null int64\n", + "PUMA5 100 non-null int64\n", + "income 100 non-null int64\n", + "PERSONS 100 non-null int64\n", + "HHT 100 non-null int64\n", + "UNITTYPE 100 non-null int64\n", + "NOC 100 non-null int64\n", + "BLDGSZ 100 non-null int64\n", + "TENURE 100 non-null int64\n", + "VEHICL 100 non-null int64\n", + "hinccat1 100 non-null int64\n", + "hinccat2 100 non-null int64\n", + "hhagecat 100 non-null int64\n", + "hsizecat 100 non-null int64\n", + "hfamily 100 non-null int64\n", + "hunittype 100 non-null int64\n", + "hNOCcat 100 non-null int64\n", + "hwrkrcat 100 non-null int64\n", + "h0004 100 non-null int64\n", + "h0511 100 non-null int64\n", + "h1215 100 non-null int64\n", + "h1617 100 non-null int64\n", + "h1824 100 non-null int64\n", + "h2534 100 non-null int64\n", + "h3549 100 non-null int64\n", + "h5064 100 non-null int64\n", + "h6579 100 non-null int64\n", + "h80up 100 non-null int64\n", + "workers 100 non-null int64\n", + "hwork_f 100 non-null int64\n", + "hwork_p 100 non-null int64\n", + "huniv 100 non-null int64\n", + "hnwork 100 non-null int64\n", + "hretire 100 non-null int64\n", + "hpresch 100 non-null int64\n", + "hschpred 100 non-null int64\n", + "hschdriv 100 non-null int64\n", + "htypdwel 100 non-null int64\n", + "hownrent 100 non-null int64\n", + "hadnwst 100 non-null int64\n", + "hadwpst 100 non-null int64\n", + "hadkids 100 non-null int64\n", + "bucketBin 100 non-null int64\n", + "originalPUMA 100 non-null int64\n", + "hmultiunit 100 non-null int64\n", + "num_college_age 100 non-null float64\n", + "non_workers 100 non-null int64\n", + "income_segment 100 non-null category\n", + "family 100 non-null bool\n", + "num_young_adults 100 non-null float64\n", + "household_type 97 non-null object\n", + "auto_ownership 100 non-null int64\n", + "drivers 100 non-null int64\n", + "income_in_thousands 100 non-null float64\n", + "home_is_rural 100 non-null bool\n", + "work_tour_auto_time_savings 100 non-null int64\n", + "num_under16_not_at_school 100 non-null int64\n", + "hhsize 100 non-null int64\n", + "num_children 100 non-null float64\n", + "car_sufficiency 100 non-null int64\n", + "non_family 100 non-null bool\n", + "num_adolescents 100 non-null float64\n", + "no_cars 100 non-null bool\n", + "num_young_children 100 non-null float64\n", + "home_is_urban 100 non-null bool\n", + "home_taz 100 non-null int64\n", + "dtypes: bool(5), category(1), float64(6), int64(54), object(1)\n", + "memory usage: 49.1 KB\n" ] } ], - "prompt_number": 14 + "prompt_number": 17 }, { "cell_type": "code", @@ -1156,64 +1283,82 @@ "stream": "stdout", "text": [ "\n", - "Int64Index: 2598 entries, 1394 to 7051868\n", - "Data columns (total 50 columns):\n", - "household_id 2598 non-null int64\n", - "age 2598 non-null int64\n", - "RELATE 2598 non-null int64\n", - "ESR 2598 non-null int64\n", - "GRADE 2598 non-null int64\n", - "PNUM 2598 non-null int64\n", - "PAUG 2598 non-null int64\n", - "DDP 2598 non-null int64\n", - "sex 2598 non-null int64\n", - "WEEKS 2598 non-null int64\n", - "HOURS 2598 non-null int64\n", - "MSP 2598 non-null int64\n", - "POVERTY 2598 non-null int64\n", - "EARNS 2598 non-null int64\n", - "pagecat 2598 non-null int64\n", - "pemploy 2598 non-null int64\n", - "pstudent 2598 non-null int64\n", - "ptype 2598 non-null int64\n", - "padkid 2598 non-null int64\n", - "student_cat 2598 non-null object\n", - "num_eat_j 2598 non-null int64\n", - "distance_to_school 2598 non-null float64\n", - "female 2598 non-null bool\n", - "non_mandatory_tour_frequency 1744 non-null float64\n", - "max_window 2598 non-null int64\n", - "employed_cat 2598 non-null object\n", - "student_is_employed 2598 non-null bool\n", - "distance_to_work 2598 non-null float64\n", - "cdap_activity 2598 non-null object\n", - "num_main_j 2598 non-null int64\n", - "num_joint_tours 2598 non-null int64\n", - "home_taz 2598 non-null int64\n", - "ptype_cat 2598 non-null object\n", - "is_student 2598 non-null bool\n", - "under16_not_at_school 2598 non-null bool\n", - "school_taz 2598 non-null int64\n", - "is_worker 2598 non-null bool\n", - "roundtrip_auto_time_to_school 2598 non-null float64\n", - "age_16_p 2598 non-null bool\n", - "workplace_taz 2598 non-null int64\n", - "workplace_in_cbd 2598 non-null bool\n", - "mandatory_tour_frequency 856 non-null object\n", - "age_16_to_19 2598 non-null bool\n", - "nonstudent_to_school 2598 non-null bool\n", - "num_shop_j 2598 non-null int64\n", - "num_mand 2598 non-null float64\n", - "num_visi_j 2598 non-null int64\n", - "roundtrip_auto_time_to_work 2598 non-null float64\n", - "num_disc_j 2598 non-null int64\n", - "male 2598 non-null bool\n", - "dtypes: bool(10), float64(6), int64(29), object(5)\n", - "memory usage: 857.5 KB\n" + "Int64Index: 245 entries, 7265 to 7010942\n", + "Data columns (total 68 columns):\n", + "household_id 245 non-null int64\n", + "age 245 non-null int64\n", + "RELATE 245 non-null int64\n", + "ESR 245 non-null int64\n", + "GRADE 245 non-null int64\n", + "PNUM 245 non-null int64\n", + "PAUG 245 non-null int64\n", + "DDP 245 non-null int64\n", + "sex 245 non-null int64\n", + "WEEKS 245 non-null int64\n", + "HOURS 245 non-null int64\n", + "MSP 245 non-null int64\n", + "POVERTY 245 non-null int64\n", + "EARNS 245 non-null int64\n", + "pagecat 245 non-null int64\n", + "pemploy 245 non-null int64\n", + "pstudent 245 non-null int64\n", + "ptype 245 non-null int64\n", + "padkid 245 non-null int64\n", + "has_preschool_kid 245 non-null bool\n", + "student_cat 245 non-null object\n", + "num_eat_j 245 non-null int64\n", + "has_driving_kid 245 non-null bool\n", + "home_taz 245 non-null int64\n", + "work_and_school_and_worker 245 non-null bool\n", + "work_and_school_and_student 245 non-null bool\n", + "female 245 non-null bool\n", + "has_preschool_kid_at_home 245 non-null bool\n", + "has_full_time 245 non-null bool\n", + "is_university 245 non-null bool\n", + "max_window 245 non-null int64\n", + "employed_cat 245 non-null object\n", + "student_is_employed 245 non-null bool\n", + "is_gradeschool 245 non-null bool\n", + "is_highschool 245 non-null bool\n", + "has_retiree 245 non-null bool\n", + "cdap_activity 245 non-null object\n", + "num_main_j 245 non-null int64\n", + "num_joint_tours 245 non-null int64\n", + "has_non_worker 245 non-null bool\n", + "ptype_cat 245 non-null object\n", + "is_student 245 non-null bool\n", + "under16_not_at_school 245 non-null bool\n", + "has_school_kid 245 non-null bool\n", + "school_taz 245 non-null float64\n", + "is_worker 245 non-null bool\n", + "roundtrip_auto_time_to_school 245 non-null float64\n", + "distance_to_school 245 non-null float64\n", + "age_16_p 245 non-null bool\n", + "workplace_taz 245 non-null int64\n", + "workplace_in_cbd 245 non-null bool\n", + "has_university 245 non-null bool\n", + "adult 245 non-null bool\n", + "non_mandatory_tour_frequency 162 non-null float64\n", + "nonstudent_to_school 245 non-null bool\n", + "age_16_to_19 245 non-null bool\n", + "num_non_escort_tours 245 non-null float64\n", + "mandatory_tour_frequency 70 non-null object\n", + "num_shop_j 245 non-null int64\n", + "num_mand 245 non-null float64\n", + "num_visi_j 245 non-null int64\n", + "num_escort_tours 245 non-null float64\n", + "roundtrip_auto_time_to_work 245 non-null float64\n", + "num_disc_j 245 non-null int64\n", + "has_part_time 245 non-null bool\n", + "has_school_kid_at_home 245 non-null bool\n", + "distance_to_work 245 non-null float64\n", + "male 245 non-null bool\n", + "dtypes: bool(26), float64(9), int64(28), object(5)\n", + "memory usage: 88.5 KB\n" ] } ], - "prompt_number": 15 + "prompt_number": 18 }, { "cell_type": "heading", @@ -1251,8 +1396,15 @@ "input": [], "language": "python", "metadata": {}, - "outputs": [], - "prompt_number": 15 + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] } ], "metadata": {} From 3e9577df2e56b8df62b404be2079535ee6ceef05 Mon Sep 17 00:00:00 2001 From: Fletcher Foti Date: Mon, 13 Apr 2015 14:14:17 -0700 Subject: [PATCH 2/3] needed to add skims too will check out this branch and try it before merging --- example/simulation.ipynb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/simulation.ipynb b/example/simulation.ipynb index 8ab592919b..a9aa169a8c 100644 --- a/example/simulation.ipynb +++ b/example/simulation.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:152ef8dbdb0f3a320097bcb1e85dfbaf7ff1db79dd2c0dd5f0beb089b8b2c5ca" + "signature": "sha256:1cbfbf8db4e969948889acbc5a7672f9b31bb1e19c2bfe7af98148be67947267" }, "nbformat": 3, "nbformat_minor": 0, @@ -37,7 +37,8 @@ "import pandas as pd\n", "import os\n", "sim.add_injectable(\"store\", pd.HDFStore(\n", - " os.path.join(\"..\", \"activitysim\", \"defaults\", \"test\", \"test.h5\"), \"r\"))" + " os.path.join(\"..\", \"activitysim\", \"defaults\", \"test\", \"test.h5\"), \"r\"))\n", + "sim.add_injectable(\"nonmotskm_matrix\", np.ones((1454, 1454)))" ], "language": "python", "metadata": {}, From 8fe4c97226197f010cafe5a06507d9865a64b81e Mon Sep 17 00:00:00 2001 From: Fletcher Foti Date: Mon, 13 Apr 2015 14:17:03 -0700 Subject: [PATCH 3/3] needed to import numpy looks like that's it - this should be sufficient to run the notebook with the included test data so everything you need to run activitysim and try it out is in this repo --- example/simulation.ipynb | 767 +++++++++++++++++++-------------------- 1 file changed, 373 insertions(+), 394 deletions(-) diff --git a/example/simulation.ipynb b/example/simulation.ipynb index a9aa169a8c..01b78ca7e4 100644 --- a/example/simulation.ipynb +++ b/example/simulation.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:1cbfbf8db4e969948889acbc5a7672f9b31bb1e19c2bfe7af98148be67947267" + "signature": "sha256:7a8230b2c21bf7bd8085ec73ad6088bb2a4d40b26c5312fa01c6f8c62bd4ac7c" }, "nbformat": 3, "nbformat_minor": 0, @@ -35,6 +35,7 @@ "collapsed": false, "input": [ "import pandas as pd\n", + "import numpy as np\n", "import os\n", "sim.add_injectable(\"store\", pd.HDFStore(\n", " os.path.join(\"..\", \"activitysim\", \"defaults\", \"test\", \"test.h5\"), \"r\"))\n", @@ -43,7 +44,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 2 + "prompt_number": 3 }, { "cell_type": "code", @@ -66,7 +67,9 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['mode_choice_logsums']\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\" 'mode_choice_logsums']\n", "WARNING: Some columns have no variability:\n" ] }, @@ -74,7 +77,9 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['mode_choice_logsums']\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\" 'mode_choice_logsums']\n", "WARNING: Some columns have no variability:\n" ] }, @@ -82,29 +87,25 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['mode_choice_logsums']\n", - "Describe of choices:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "count 245.000000\n", - "mean 238.930612\n", - "std 445.364760\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\" 'mode_choice_logsums']\n", + "Describe of choices:\n", + "count 267.000000\n", + "mean 205.059925\n", + "std 383.520970\n", "min -1.000000\n", "25% -1.000000\n", "50% -1.000000\n", - "75% 69.000000\n", - "max 1434.000000\n", + "75% 260.500000\n", + "max 1424.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'school_location_simulate': 20.29s\n", - "Total time to execute: 20.29s\n" + "Time to execute model 'school_location_simulate': 0.98s\n", + "Total time to execute: 0.98s\n" ] } ], - "prompt_number": 3 + "prompt_number": 4 }, { "cell_type": "code", @@ -127,7 +128,11 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['mode_choice_logsums']\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"\n", + " \"@(df.income_segment>=3)*(skims['DISTANCE']-5).clip(0)\"\n", + " 'mode_choice_logsums']\n", "Describe of choices:\n" ] }, @@ -135,21 +140,21 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 245.000000\n", - "mean 875.302041\n", - "std 409.872059\n", - "min 2.000000\n", - "25% 583.000000\n", - "50% 970.000000\n", - "75% 1199.000000\n", - "max 1452.000000\n", + "count 267.000000\n", + "mean 653.340824\n", + "std 450.452880\n", + "min 1.000000\n", + "25% 310.000000\n", + "50% 563.000000\n", + "75% 1046.500000\n", + "max 1450.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'workplace_location_simulate': 4.51s\n", - "Total time to execute: 4.51s\n" + "Time to execute model 'workplace_location_simulate': 2.10s\n", + "Total time to execute: 2.10s\n" ] } ], - "prompt_number": 4 + "prompt_number": 5 }, { "cell_type": "code", @@ -164,19 +169,19 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 245.000000\n", - "mean 2.074041\n", - "std 1.193102\n", - "min 0.280000\n", - "25% 1.090000\n", - "50% 1.980000\n", - "75% 2.790000\n", - "max 8.880000\n", + "count 267\n", + "mean 1\n", + "std 0\n", + "min 1\n", + "25% 1\n", + "50% 1\n", + "75% 1\n", + "max 1\n", "dtype: float64\n" ] } ], - "prompt_number": 5 + "prompt_number": 6 }, { "cell_type": "code", @@ -199,20 +204,20 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['@1' \"county_name == 'Napa'\" 'work_tour_auto_time_savings / (workers+1)']\n", + "['@1' 'work_tour_auto_time_savings / (workers+1)']\n", "Choices:\n", - "2 41\n", - "1 36\n", - "3 13\n", - "0 9\n", - "4 1\n", + "2 47\n", + "1 28\n", + "3 12\n", + "0 10\n", + "4 3\n", "dtype: int64\n", - "Time to execute model 'auto_ownership_simulate': 0.25s\n", - "Total time to execute: 0.25s\n" + "Time to execute model 'auto_ownership_simulate': 0.23s\n", + "Total time to execute: 0.23s\n" ] } ], - "prompt_number": 6 + "prompt_number": 7 }, { "cell_type": "code", @@ -235,16 +240,16 @@ "output_type": "stream", "stream": "stdout", "text": [ - "NonMandatory 92\n", - "Home 83\n", - "Mandatory 70\n", + "Home 103\n", + "NonMandatory 84\n", + "Mandatory 80\n", "dtype: int64\n", - "Time to execute model 'cdap_simulate': 5.54s\n", - "Total time to execute: 5.54s\n" + "Time to execute model 'cdap_simulate': 3.89s\n", + "Total time to execute: 3.89s\n" ] } ], - "prompt_number": 7 + "prompt_number": 8 }, { "cell_type": "code", @@ -260,7 +265,7 @@ "stream": "stdout", "text": [ "Running model 'mandatory_tour_frequency'\n", - "70 persons run for mandatory tour model" + "80 persons run for mandatory tour model" ] }, { @@ -268,14 +273,14 @@ "stream": "stdout", "text": [ "\n", - "count 70.000000\n", - "mean 840.771429\n", - "std 377.661384\n", - "min 16.000000\n", - "25% 568.000000\n", - "50% 927.500000\n", - "75% 1125.000000\n", - "max 1433.000000\n", + "count 80.000000\n", + "mean 589.800000\n", + "std 449.608617\n", + "min 1.000000\n", + "25% 238.750000\n", + "50% 507.500000\n", + "75% 969.250000\n", + "max 1448.000000\n", "Name: workplace_taz, dtype: float64\n", "WARNING: Some columns have no variability:\n" ] @@ -284,41 +289,28 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(ptype == 3) & female' '(ptype == 6) & female'\n", - " '(ptype == 2) & (age <= 35)' '(ptype == 3) & (age <= 35)'\n", - " '(ptype == 3) & (distance_to_school < 3)'\n", - " '(ptype == 6) & (distance_to_school < 3)'\n", - " '(ptype == 3) & student_is_employed' '(ptype == 6) & student_is_employed'\n", - " '(ptype == 1) & nonstudent_to_school'\n", + "['(ptype == 1) & nonstudent_to_school'\n", " '(ptype == 2) & nonstudent_to_school'\n", " '(ptype == 4) & nonstudent_to_school'\n", " '(ptype == 5) & nonstudent_to_school'\n", - " '(ptype == 1) & (auto_ownership == 0)'\n", - " '(ptype == 2) & (auto_ownership == 0)'\n", - " '(ptype == 3) & (auto_ownership == 0)'\n", + " '(ptype == 5) & (auto_ownership == 0)'\n", " '(ptype == 6) & (auto_ownership == 0)'\n", - " '(ptype == 7) & (auto_ownership == 0)'\n", - " '(ptype == 3) & (auto_ownership < drivers)'\n", - " '(ptype == 3) * (num_young_children)'\n", - " '(ptype == 5) * (num_young_children)'\n", - " '(ptype == 3) & (income_in_thousands > 50)' '(ptype == 2) & non_family'\n", - " '(ptype == 3) & non_family' '(ptype == 6) & non_family'\n", - " '(ptype == 7) & non_family' '(ptype == 2) & home_is_urban'\n", - " '(ptype == 5) & home_is_urban' '(ptype == 6) & home_is_urban'\n", + " '(ptype == 2) * (num_young_children)'\n", + " '(ptype == 5) * (num_young_children)' '(ptype == 6) & non_family'\n", + " '(ptype == 7) & non_family' '(ptype == 6) & home_is_urban'\n", " '~(workplace_taz > -1)']\n", "Choices:\n", - "work1 42\n", - "work2 17\n", - "school1 7\n", + "work1 41\n", + "work2 28\n", + "school1 9\n", "work_and_school 2\n", - "school2 2\n", "dtype: int64\n", - "Time to execute model 'mandatory_tour_frequency': 2.90s\n", - "Total time to execute: 2.90s\n" + "Time to execute model 'mandatory_tour_frequency': 0.87s\n", + "Total time to execute: 0.87s\n" ] } ], - "prompt_number": 8 + "prompt_number": 9 }, { "cell_type": "code", @@ -332,15 +324,15 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 9, + "prompt_number": 10, "text": [ - "work 78\n", - "school 13\n", + "work 99\n", + "school 11\n", "dtype: int64" ] } ], - "prompt_number": 9 + "prompt_number": 10 }, { "cell_type": "code", @@ -356,7 +348,7 @@ "stream": "stdout", "text": [ "Running model 'mandatory_scheduling'\n", - "Running 13 school tour scheduling choices" + "Running 11 school tour scheduling choices" ] }, { @@ -372,11 +364,9 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(ptype == 4) * start' '(ptype == 3) * start' '(ptype == 3) * duration'\n", - " '(workers == hhsize) * duration' '(tour_num > 1) & (start < end_previous)'\n", - " '(tour_num > 1) * duration' '(tour_num > 1) & (duration < 6)'\n", - " 'work_and_school_and_worker & (duration < 6)']\n", - "Running 2 #2 tour choices\n", + "['(ptype == 4) * start' '(tour_num > 1) & (start < end_previous)']\n", + "Running 99 work tour scheduling choices\n", + "Running 71 #1 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -384,24 +374,8 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(ptype == 1) * start' '(ptype == 1) * duration' '(ptype == 4) * start'\n", - " '(ptype == 3) * start' '(ptype == 3) * duration'\n", - " '(workers == hhsize) * duration' '(tour_num == 1) * start'\n", - " '(tour_num == 1) * duration' '(tour_num == 1) & (duration < 6)'\n", - " 'work_and_school_and_worker & (duration < 6)'\n", - " 'work_and_school_and_student & (duration < 6)']\n", - "Running 78 work tour scheduling choices\n", - "Running 61 #1 tour choices\n", - "WARNING: Some columns have no variability:\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "['home_is_rural & (start < 6)' 'home_is_rural & (end > 22)'\n", - " \"(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)\"]\n", - "Running 17 #2 tour choices" + "['home_is_rural & (start < 6)' 'home_is_rural & (end > 22)']\n", + "Running 28 #2 tour choices" ] }, { @@ -418,26 +392,28 @@ "text": [ "['(ptype == 2) * start' '(ptype == 3) * start' '(tour_num == 1) * start'\n", " '(tour_num == 1) * duration' 'home_is_rural & (start < 6)'\n", - " 'home_is_rural & (end > 22)' '(ptype == 2) & (end > 12) & (end < 16)'\n", + " 'home_is_rural & (end > 22)' '(ptype == 1) & (duration < 9)'\n", + " '(ptype == 1) & (start > 9) & (start < 13)'\n", + " '(ptype == 2) & (end > 12) & (end < 16)'\n", " '(tour_num == 1) & (duration < 8)'\n", " \"(mandatory_tour_frequency == 'work_and_school') & is_worker & (duration < 8)\"\n", " \"(mandatory_tour_frequency == 'work_and_school') & is_student & (duration < 8)\"]\n", "Choices:\n", - "count 91.000000\n", - "mean 163.131868\n", - "std 59.405613\n", + "count 110.000000\n", + "mean 156.118182\n", + "std 66.378776\n", "min 0.000000\n", - "25% 182.000000\n", + "25% 176.000000\n", "50% 187.000000\n", - "75% 189.000000\n", + "75% 188.000000\n", "max 189.000000\n", "dtype: float64\n", - "Time to execute model 'mandatory_scheduling': 3.31s\n", - "Total time to execute: 3.31s\n" + "Time to execute model 'mandatory_scheduling': 1.48s\n", + "Total time to execute: 1.48s\n" ] } ], - "prompt_number": 10 + "prompt_number": 11 }, { "cell_type": "code", @@ -453,7 +429,7 @@ "stream": "stdout", "text": [ "Running model 'non_mandatory_tour_frequency'\n", - "162 persons run for non-mandatory tour model" + "164 persons run for non-mandatory tour model" ] }, { @@ -492,21 +468,20 @@ " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", - " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", - " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", - " 'has_retiree * escort' 'has_driving_kid * escort'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_part_time * escort'\n", " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_retiree * shopping' 'has_driving_kid * shopping'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", - " 'has_retiree * othmaint' 'has_driving_kid * othmaint'\n", + " 'has_part_time * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_part_time * othmaint'\n", " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_retiree * eatout' 'has_driving_kid * eatout'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_retiree * othdiscr' 'has_driving_kid * othdiscr'\n", + " 'has_part_time * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_part_time * othdiscr'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'\n", - " 'escort * no_cars']\n", - "Running segment 'full' of size 47\n", + " 'home_is_urban & (tot_tours == 1)' 'home_is_urban & (tot_tours == 2)'\n", + " 'home_is_urban & (tot_tours == 3)' 'home_is_urban & (tot_tours == 4)'\n", + " 'home_is_urban & (tot_tours > 4)' 'home_is_urban * escort'\n", + " 'home_is_urban * shopping' 'home_is_urban * othmaint'\n", + " 'home_is_urban * eatout' 'home_is_urban * othdiscr' 'escort * no_cars']\n", + "Running segment 'full' of size 46\n", "WARNING: Some columns have no variability:\n" ] }, @@ -526,7 +501,7 @@ " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'nonwork' of size 40" + "Running segment 'nonwork' of size 38" ] }, { @@ -553,7 +528,7 @@ " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'part' of size 10" + "Running segment 'part' of size 12" ] }, { @@ -575,24 +550,20 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'\n", - " 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'\n", - " 'no_cars & (tot_tours > 4)' '(car_sufficiency > 0) & (tot_tours == 1)'\n", - " '(car_sufficiency > 0) & (tot_tours == 2)'\n", - " '(car_sufficiency > 0) & (tot_tours == 3)'\n", - " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_part_time * escort'\n", - " 'has_university * escort' 'has_school_kid_at_home * escort'\n", + " 'has_part_time * escort' 'has_university * escort'\n", + " 'has_driving_kid * escort' 'has_school_kid_at_home * escort'\n", " 'has_preschool_kid_at_home * escort' 'has_part_time * shopping'\n", - " 'has_university * shopping' 'has_school_kid_at_home * shopping'\n", - " 'has_preschool_kid_at_home * shopping' 'has_part_time * othmaint'\n", - " 'has_university * othmaint' 'has_school_kid_at_home * othmaint'\n", + " 'has_university * shopping' 'has_driving_kid * shopping'\n", + " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", + " 'has_part_time * othmaint' 'has_university * othmaint'\n", + " 'has_driving_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", " 'has_preschool_kid_at_home * othmaint' 'has_part_time * eatout'\n", - " 'has_university * eatout' 'has_school_kid_at_home * eatout'\n", - " 'has_preschool_kid_at_home * eatout' 'has_part_time * othdiscr'\n", - " 'has_university * othdiscr' 'has_school_kid_at_home * othdiscr'\n", - " 'has_preschool_kid_at_home * othdiscr' 'escort * no_cars']\n", - "Running segment 'preschool' of size 13\n", + " 'has_university * eatout' 'has_driving_kid * eatout'\n", + " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", + " 'has_part_time * othdiscr' 'has_university * othdiscr'\n", + " 'has_driving_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr']\n", + "Running segment 'preschool' of size 15\n", "WARNING: Some columns have no variability:\n" ] }, @@ -607,27 +578,27 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'\n", - " 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'\n", - " 'no_cars & (tot_tours > 4)' '(car_sufficiency > 0) & (tot_tours == 1)'\n", + " '(car_sufficiency > 0) & (tot_tours == 1)'\n", " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", - " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", - " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", - " 'has_retiree * escort' 'has_university * escort'\n", - " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_retiree * shopping' 'has_university * shopping'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", - " 'has_retiree * othmaint' 'has_university * othmaint'\n", - " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_retiree * eatout' 'has_university * eatout'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", - " 'has_retiree * othdiscr' 'has_university * othdiscr'\n", - " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr'\n", - " 'escort * no_cars']\n", - "Running segment 'retired' of size 18\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_university * escort'\n", + " 'has_driving_kid * escort' 'has_school_kid_at_home * escort'\n", + " 'has_preschool_kid_at_home * escort' 'has_university * shopping'\n", + " 'has_driving_kid * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_university * othmaint'\n", + " 'has_driving_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", + " 'has_preschool_kid_at_home * othmaint' 'has_university * eatout'\n", + " 'has_driving_kid * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_university * othdiscr'\n", + " 'has_driving_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr' 'home_is_urban & (tot_tours == 1)'\n", + " 'home_is_urban & (tot_tours == 2)' 'home_is_urban & (tot_tours == 3)'\n", + " 'home_is_urban & (tot_tours == 4)' 'home_is_urban & (tot_tours > 4)'\n", + " 'home_is_urban * escort' 'home_is_urban * shopping'\n", + " 'home_is_urban * othmaint' 'home_is_urban * eatout'\n", + " 'home_is_urban * othdiscr']\n", + "Running segment 'retired' of size 20\n", "WARNING: Some columns have no variability:\n" ] }, @@ -642,27 +613,15 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " '(car_sufficiency > 0) & (tot_tours == 1)'\n", - " '(car_sufficiency > 0) & (tot_tours == 2)'\n", - " '(car_sufficiency > 0) & (tot_tours == 3)'\n", - " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)'\n", - " 'has_preschool_kid & (tot_tours == 1)'\n", - " 'has_preschool_kid & (tot_tours == 2)'\n", - " 'has_preschool_kid & (tot_tours == 3)'\n", - " 'has_preschool_kid & (tot_tours == 4)'\n", - " 'has_preschool_kid & (tot_tours == 5)' 'has_university * escort'\n", - " 'has_preschool_kid * escort' 'has_school_kid_at_home * escort'\n", - " 'has_preschool_kid_at_home * escort' 'has_university * shopping'\n", - " 'has_preschool_kid * shopping' 'has_school_kid_at_home * shopping'\n", - " 'has_preschool_kid_at_home * shopping' 'has_university * othmaint'\n", - " 'has_preschool_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", - " 'has_preschool_kid_at_home * othmaint' 'has_university * eatout'\n", - " 'has_preschool_kid * eatout' 'has_school_kid_at_home * eatout'\n", - " 'has_preschool_kid_at_home * eatout' 'has_university * othdiscr'\n", - " 'has_preschool_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", - " 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'school' of size 23\n", + " 'no_cars & (tot_tours == 1)' 'no_cars & (tot_tours == 2)'\n", + " 'no_cars & (tot_tours == 3)' 'no_cars & (tot_tours == 4)'\n", + " 'no_cars & (tot_tours > 4)' 'has_school_kid_at_home * escort'\n", + " 'has_preschool_kid_at_home * escort' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_school_kid_at_home * othmaint'\n", + " 'has_preschool_kid_at_home * othmaint' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_school_kid_at_home * othdiscr'\n", + " 'has_preschool_kid_at_home * othdiscr' 'escort * no_cars']\n", + "Running segment 'school' of size 21\n", "WARNING: Some columns have no variability:\n" ] }, @@ -681,13 +640,15 @@ " '(car_sufficiency > 0) & (tot_tours == 2)'\n", " '(car_sufficiency > 0) & (tot_tours == 3)'\n", " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)'\n", + " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_university * escort'\n", " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", - " 'has_school_kid_at_home * shopping' 'has_preschool_kid_at_home * shopping'\n", + " 'has_university * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_preschool_kid_at_home * shopping' 'has_university * othmaint'\n", " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", - " 'has_school_kid_at_home * eatout' 'has_preschool_kid_at_home * eatout'\n", + " 'has_university * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_preschool_kid_at_home * eatout' 'has_university * othdiscr'\n", " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", - "Running segment 'university' of size 7" + "Running segment 'university' of size 8" ] }, { @@ -709,61 +670,51 @@ " 'max_window*(tot_tours == 0)' 'max_window*(tot_tours == 1)'\n", " 'max_window*(tot_tours == 2)' 'max_window*(tot_tours == 3)'\n", " 'max_window*(tot_tours == 4)' 'max_window*(tot_tours > 4)'\n", - " '(car_sufficiency > 0) & (tot_tours == 1)'\n", - " '(car_sufficiency > 0) & (tot_tours == 2)'\n", - " '(car_sufficiency > 0) & (tot_tours == 3)'\n", - " '(car_sufficiency > 0) & (tot_tours == 4)'\n", - " '(car_sufficiency > 0) & (tot_tours > 4)' 'has_retiree & (tot_tours == 1)'\n", - " 'has_retiree & (tot_tours == 2)' 'has_retiree & (tot_tours == 3)'\n", - " 'has_retiree & (tot_tours == 4)' 'has_retiree & (tot_tours == 5)'\n", - " 'has_preschool_kid & (tot_tours == 1)'\n", - " 'has_preschool_kid & (tot_tours == 2)'\n", - " 'has_preschool_kid & (tot_tours == 3)'\n", - " 'has_preschool_kid & (tot_tours == 4)'\n", - " 'has_preschool_kid & (tot_tours == 5)' 'has_part_time * escort'\n", - " 'has_retiree * escort' 'has_university * escort'\n", - " 'has_preschool_kid * escort' 'has_school_kid_at_home * escort'\n", - " 'has_preschool_kid_at_home * escort' 'has_part_time * shopping'\n", - " 'has_retiree * shopping' 'has_university * shopping'\n", - " 'has_preschool_kid * shopping' 'has_school_kid_at_home * shopping'\n", + " 'has_school_kid & (tot_tours == 1)' 'has_school_kid & (tot_tours == 2)'\n", + " 'has_school_kid & (tot_tours == 3)' 'has_school_kid & (tot_tours == 4)'\n", + " 'has_school_kid & (tot_tours == 5)' 'has_part_time * escort'\n", + " 'has_driving_kid * escort' 'has_school_kid * escort'\n", + " 'has_school_kid_at_home * escort' 'has_preschool_kid_at_home * escort'\n", + " 'has_part_time * shopping' 'has_driving_kid * shopping'\n", + " 'has_school_kid * shopping' 'has_school_kid_at_home * shopping'\n", " 'has_preschool_kid_at_home * shopping' 'has_part_time * othmaint'\n", - " 'has_retiree * othmaint' 'has_university * othmaint'\n", - " 'has_preschool_kid * othmaint' 'has_school_kid_at_home * othmaint'\n", - " 'has_preschool_kid_at_home * othmaint' 'has_part_time * eatout'\n", - " 'has_retiree * eatout' 'has_university * eatout'\n", - " 'has_preschool_kid * eatout' 'has_school_kid_at_home * eatout'\n", + " 'has_driving_kid * othmaint' 'has_school_kid * othmaint'\n", + " 'has_school_kid_at_home * othmaint' 'has_preschool_kid_at_home * othmaint'\n", + " 'has_part_time * eatout' 'has_driving_kid * eatout'\n", + " 'has_school_kid * eatout' 'has_school_kid_at_home * eatout'\n", " 'has_preschool_kid_at_home * eatout' 'has_part_time * othdiscr'\n", - " 'has_retiree * othdiscr' 'has_university * othdiscr'\n", - " 'has_preschool_kid * othdiscr' 'has_school_kid_at_home * othdiscr'\n", - " 'has_preschool_kid_at_home * othdiscr']\n", + " 'has_driving_kid * othdiscr' 'has_school_kid * othdiscr'\n", + " 'has_school_kid_at_home * othdiscr' 'has_preschool_kid_at_home * othdiscr']\n", "Choices:\n", - "0 70\n", - "16 23\n", - "1 16\n", - "32 11\n", - "8 11\n", - "4 7\n", + "0 79\n", + "16 21\n", + "1 15\n", + "4 10\n", + "8 10\n", + "32 7\n", "2 5\n", - "17 4\n", - "13 2\n", - "9 2\n", - "10 2\n", - "12 1\n", - "80 1\n", - "68 1\n", - "82 1\n", - "18 1\n", + "48 2\n", + "17 2\n", "20 1\n", + "5 1\n", + "10 1\n", + "88 1\n", + "84 1\n", "33 1\n", + "34 1\n", "40 1\n", - "88 1\n", + "64 1\n", + "65 1\n", + "68 1\n", + "80 1\n", + "26 1\n", "dtype: int64\n", - "Time to execute model 'non_mandatory_tour_frequency': 9.15s\n", - "Total time to execute: 9.15s\n" + "Time to execute model 'non_mandatory_tour_frequency': 8.13s\n", + "Total time to execute: 8.13s\n" ] } ], - "prompt_number": 11 + "prompt_number": 12 }, { "cell_type": "code", @@ -777,19 +728,19 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 12, + "prompt_number": 13, "text": [ - "shopping 32\n", - "othdiscr 25\n", - "escort 21\n", - "othmaint 20\n", - "eatout 12\n", - "social 9\n", + "shopping 30\n", + "escort 24\n", + "othdiscr 20\n", + "eatout 14\n", + "othmaint 14\n", + "social 8\n", "dtype: int64" ] } ], - "prompt_number": 12 + "prompt_number": 13 }, { "cell_type": "code", @@ -814,79 +765,98 @@ "text": [ "\n", "eatout\n", - "Running segment 'eatout' of size 12\n", - "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + "Running segment 'eatout' of size 14\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')\n", "shopping\n", - "Running segment 'shopping' of size 21\n", - "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + "Running segment 'shopping' of size 24\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')\n", "othdiscr\n", - "Running segment 'othdiscr' of size 25\n", - "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + "Running segment 'othdiscr' of size 20\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')\n", "othmaint\n", - "Running segment 'othmaint' of size 20\n", - "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + "Running segment 'othmaint' of size 14\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')\n", "shopping\n", - "Running segment 'shopping' of size 32\n", - "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')" + "Running segment 'shopping' of size 30\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Index([u'university', u'highschool', u'gradeschool', u'escortkids', u'escortnokids', u'shopping', u'eatout', u'othmaint', u'social', u'othdiscr', u'workbased'], dtype='object')\n", "social\n", - "Running segment 'social' of size 9\n", - "Choices:\n" + "Running segment 'social' of size 8\n", + "WARNING: Some columns have no variability:\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ - "count 119.000000\n", - "mean 803.058824\n", - "std 427.918282\n", - "min 4.000000\n", - "25% 469.500000\n", - "50% 947.000000\n", - "75% 1166.500000\n", - "max 1441.000000\n", + "[\"@skims['DISTANCE'].clip(1)\" \"@(skims['DISTANCE']-1).clip(0,1)\"\n", + " \"@(skims['DISTANCE']-2).clip(0,3)\" \"@(skims['DISTANCE']-5).clip(0,10)\"\n", + " \"@(skims['DISTANCE']-15.0).clip(0)\"]\n", + "Choices:\n", + "count 110.000000\n", + "mean 736.836364\n", + "std 466.741142\n", + "min 2.000000\n", + "25% 373.500000\n", + "50% 688.500000\n", + "75% 1164.000000\n", + "max 1448.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'destination_choice': 3.45s\n", - "Total time to execute: 3.45s\n" + "Time to execute model 'destination_choice': 1.83s\n", + "Total time to execute: 1.83s\n" ] } ], - "prompt_number": 13 + "prompt_number": 14 }, { "cell_type": "code", @@ -902,7 +872,7 @@ "stream": "stdout", "text": [ "Running model 'non_mandatory_scheduling'\n", - "Running 119 non-mandatory tour scheduling choices" + "Running 110 non-mandatory tour scheduling choices" ] }, { @@ -910,7 +880,7 @@ "stream": "stdout", "text": [ "\n", - "Running 92 #1 tour choices\n", + "Running 85 #1 tour choices\n", "WARNING: Some columns have no variability:\n" ] }, @@ -920,11 +890,10 @@ "text": [ "['(start <= end_previous) & (tour_num > 1)'\n", " '(tour_type == \"oth_maint\") * start'\n", - " '(tour_type == \"oth_maint\") * duration' 'num_mand * start'\n", - " 'num_joint_tours * start' '(tour_num > 1) * duration'\n", - " '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(tour_type == \"oth_maint\") * duration' 'num_joint_tours * start'\n", + " '(tour_num > 1) * duration' '(tour_type == \"oth_maint\") & (start < 7)'\n", " '(tour_type == \"othdisc\") & (duration < 2)']\n", - "Running 19 #2 tour choices" + "Running 17 #2 tour choices" ] }, { @@ -939,16 +908,11 @@ "output_type": "stream", "stream": "stdout", "text": [ - "['(tour_type == \"shopping\") * start' '(tour_type == \"shopping\") * duration'\n", - " '(tour_type == \"oth_maint\") * start'\n", - " '(tour_type == \"oth_maint\") * duration' '(ptype == 6) * start'\n", - " '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'\n", - " 'num_mand * start' 'num_joint_tours * start' '(tour_num == 1) * start'\n", - " '(tour_type == \"oth_maint\") & (start < 7)'\n", - " '(tour_type == \"shopping\") & (start < 8)'\n", - " '(tour_type == \"shopping\") & (end > 22)' '(ptype == 7) & (end > 22)'\n", - " '(tour_type == \"shopping\") & (duration < 2)'\n", - " '(tour_type == \"othdisc\") & (duration < 2)']\n", + "['(tour_type == \"oth_maint\") * start'\n", + " '(tour_type == \"oth_maint\") * duration' '(ptype == 7) * start'\n", + " '(ptype == 7) * duration' 'num_mand * start' 'num_joint_tours * start'\n", + " '(tour_num == 1) * start' '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(ptype == 7) & (end > 22)' '(tour_type == \"othdisc\") & (duration < 2)']\n", "Running 6 #3 tour choices\n", "WARNING: Some columns have no variability:\n" ] @@ -958,12 +922,10 @@ "stream": "stdout", "text": [ "['(tour_type == \"oth_maint\") * start'\n", - " '(tour_type == \"oth_maint\") * duration' '(tour_type == \"social\") * start'\n", - " '(tour_type == \"social\") * duration' '(ptype == 6) * start'\n", - " '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'\n", - " 'destination_in_cbd * duration' 'num_mand * start'\n", - " 'num_joint_tours * start' '(tour_num == 1) * start'\n", - " '(tour_type == \"oth_maint\") & (start < 7)' '(ptype == 7) & (end > 22)'\n", + " '(tour_type == \"oth_maint\") * duration' '(ptype == 7) * start'\n", + " '(ptype == 7) * duration' 'num_mand * start' 'num_joint_tours * start'\n", + " '(tour_num == 1) * start' '(tour_type == \"oth_maint\") & (start < 7)'\n", + " '(ptype == 7) & (end > 22)' '(ptype == 3) & (end > 22)'\n", " '(tour_type == \"othdisc\") & (duration < 2)'\n", " '(tour_type == \"escort\") & (start < 6)'\n", " '(tour_type == \"escort\") & (start == 6)'\n", @@ -1002,10 +964,11 @@ "text": [ "['(tour_type == \"shopping\") * start' '(tour_type == \"shopping\") * duration'\n", " '(tour_type == \"oth_maint\") * start'\n", - " '(tour_type == \"oth_maint\") * duration' '(tour_type == \"eatout\") * start'\n", - " '(ptype == 6) * start' '(ptype == 6) * duration' '(ptype == 7) * start'\n", - " '(ptype == 7) * duration' 'destination_in_cbd * duration'\n", - " 'num_mand * start' 'num_joint_tours * start' '(tour_num == 1) * start'\n", + " '(tour_type == \"oth_maint\") * duration' '(tour_type == \"social\") * start'\n", + " '(tour_type == \"social\") * duration' '(ptype == 6) * start'\n", + " '(ptype == 6) * duration' '(ptype == 7) * start' '(ptype == 7) * duration'\n", + " 'destination_in_cbd * duration' 'num_mand * start'\n", + " 'num_joint_tours * start' '(tour_num == 1) * start'\n", " '(tour_type == \"oth_maint\") & (start < 7)'\n", " '(tour_type == \"shopping\") & (start < 8)'\n", " '(tour_type == \"shopping\") & (end > 22)' '(ptype == 7) & (end > 22)'\n", @@ -1039,21 +1002,21 @@ " '(tour_type == \"escort\") & (duration > 10) & (duration < 14)'\n", " '(tour_type == \"escort\") & (duration > 13) & (duration < 19)']\n", "Choices:\n", - "count 119.000000\n", - "mean 160.117647\n", - "std 66.806599\n", + "count 110.000000\n", + "mean 159.709091\n", + "std 66.475124\n", "min 0.000000\n", "25% 187.000000\n", "50% 188.000000\n", "75% 189.000000\n", "max 189.000000\n", "dtype: float64\n", - "Time to execute model 'non_mandatory_scheduling': 4.70s\n", - "Total time to execute: 4.70s\n" + "Time to execute model 'non_mandatory_scheduling': 3.23s\n", + "Total time to execute: 3.23s\n" ] } ], - "prompt_number": 14 + "prompt_number": 15 }, { "cell_type": "code", @@ -1093,20 +1056,26 @@ "stream": "stdout", "text": [ "['2 * terminal_time' '@df.daily_parking_cost / costShareSr2 '\n", + " \"@out_skims['HOV2_TIME'] + in_skims['HOV2_TIME']\"\n", + " \"@out_skims['SOVTOLL_BTOLL'] + in_skims['SOVTOLL_BTOLL']\"\n", + " \"@out_skims['SOVTOLL_TIME'] + in_skims['SOVTOLL_TIME']\"\n", + " \"@out_skims['SOVTOLL_VTOLL'] + in_skims['SOVTOLL_VTOLL']\"\n", + " \"@out_skims['SOV_BTOLL'] + in_skims['SOV_BTOLL']\"\n", + " \"@out_skims['SOV_TIME'] + in_skims['SOV_TIME']\" 'age_16_to_19'\n", " 'daily_parking_cost' 'hov2_available == False' 'is_joint'\n", " 'is_joint & (number_of_participants > 2)' 'sov_available == False'\n", " 'sovtoll_available == False' 'work_tour_is_drive']\n", "Choices:\n", - "1 28\n", - "2 25\n", - "0 25\n", + "1 40\n", + "0 35\n", + "2 24\n", "dtype: int64\n", - "Time to execute model 'mode_choice_simulate': 4.63s\n", - "Total time to execute: 4.63s\n" + "Time to execute model 'mode_choice_simulate': 2.77s\n", + "Total time to execute: 2.77s\n" ] } ], - "prompt_number": 15 + "prompt_number": 16 }, { "cell_type": "code", @@ -1178,7 +1147,7 @@ ] } ], - "prompt_number": 16 + "prompt_number": 17 }, { "cell_type": "code", @@ -1194,7 +1163,7 @@ "stream": "stdout", "text": [ "\n", - "Int64Index: 100 entries, 1012634 to 1307265\n", + "Int64Index: 100 entries, 2624246 to 558870\n", "Data columns (total 67 columns):\n", "TAZ 100 non-null int64\n", "SERIALNO 100 non-null int64\n", @@ -1247,7 +1216,7 @@ "income_segment 100 non-null category\n", "family 100 non-null bool\n", "num_young_adults 100 non-null float64\n", - "household_type 97 non-null object\n", + "household_type 96 non-null object\n", "auto_ownership 100 non-null int64\n", "drivers 100 non-null int64\n", "income_in_thousands 100 non-null float64\n", @@ -1268,7 +1237,7 @@ ] } ], - "prompt_number": 17 + "prompt_number": 18 }, { "cell_type": "code", @@ -1284,82 +1253,82 @@ "stream": "stdout", "text": [ "\n", - "Int64Index: 245 entries, 7265 to 7010942\n", + "Int64Index: 267 entries, 84601 to 6968468\n", "Data columns (total 68 columns):\n", - "household_id 245 non-null int64\n", - "age 245 non-null int64\n", - "RELATE 245 non-null int64\n", - "ESR 245 non-null int64\n", - "GRADE 245 non-null int64\n", - "PNUM 245 non-null int64\n", - "PAUG 245 non-null int64\n", - "DDP 245 non-null int64\n", - "sex 245 non-null int64\n", - "WEEKS 245 non-null int64\n", - "HOURS 245 non-null int64\n", - "MSP 245 non-null int64\n", - "POVERTY 245 non-null int64\n", - "EARNS 245 non-null int64\n", - "pagecat 245 non-null int64\n", - "pemploy 245 non-null int64\n", - "pstudent 245 non-null int64\n", - "ptype 245 non-null int64\n", - "padkid 245 non-null int64\n", - "has_preschool_kid 245 non-null bool\n", - "student_cat 245 non-null object\n", - "num_eat_j 245 non-null int64\n", - "has_driving_kid 245 non-null bool\n", - "home_taz 245 non-null int64\n", - "work_and_school_and_worker 245 non-null bool\n", - "work_and_school_and_student 245 non-null bool\n", - "female 245 non-null bool\n", - "has_preschool_kid_at_home 245 non-null bool\n", - "has_full_time 245 non-null bool\n", - "is_university 245 non-null bool\n", - "max_window 245 non-null int64\n", - "employed_cat 245 non-null object\n", - "student_is_employed 245 non-null bool\n", - "is_gradeschool 245 non-null bool\n", - "is_highschool 245 non-null bool\n", - "has_retiree 245 non-null bool\n", - "cdap_activity 245 non-null object\n", - "num_main_j 245 non-null int64\n", - "num_joint_tours 245 non-null int64\n", - "has_non_worker 245 non-null bool\n", - "ptype_cat 245 non-null object\n", - "is_student 245 non-null bool\n", - "under16_not_at_school 245 non-null bool\n", - "has_school_kid 245 non-null bool\n", - "school_taz 245 non-null float64\n", - "is_worker 245 non-null bool\n", - "roundtrip_auto_time_to_school 245 non-null float64\n", - "distance_to_school 245 non-null float64\n", - "age_16_p 245 non-null bool\n", - "workplace_taz 245 non-null int64\n", - "workplace_in_cbd 245 non-null bool\n", - "has_university 245 non-null bool\n", - "adult 245 non-null bool\n", - "non_mandatory_tour_frequency 162 non-null float64\n", - "nonstudent_to_school 245 non-null bool\n", - "age_16_to_19 245 non-null bool\n", - "num_non_escort_tours 245 non-null float64\n", - "mandatory_tour_frequency 70 non-null object\n", - "num_shop_j 245 non-null int64\n", - "num_mand 245 non-null float64\n", - "num_visi_j 245 non-null int64\n", - "num_escort_tours 245 non-null float64\n", - "roundtrip_auto_time_to_work 245 non-null float64\n", - "num_disc_j 245 non-null int64\n", - "has_part_time 245 non-null bool\n", - "has_school_kid_at_home 245 non-null bool\n", - "distance_to_work 245 non-null float64\n", - "male 245 non-null bool\n", + "household_id 267 non-null int64\n", + "age 267 non-null int64\n", + "RELATE 267 non-null int64\n", + "ESR 267 non-null int64\n", + "GRADE 267 non-null int64\n", + "PNUM 267 non-null int64\n", + "PAUG 267 non-null int64\n", + "DDP 267 non-null int64\n", + "sex 267 non-null int64\n", + "WEEKS 267 non-null int64\n", + "HOURS 267 non-null int64\n", + "MSP 267 non-null int64\n", + "POVERTY 267 non-null int64\n", + "EARNS 267 non-null int64\n", + "pagecat 267 non-null int64\n", + "pemploy 267 non-null int64\n", + "pstudent 267 non-null int64\n", + "ptype 267 non-null int64\n", + "padkid 267 non-null int64\n", + "has_preschool_kid 267 non-null bool\n", + "student_cat 267 non-null object\n", + "num_eat_j 267 non-null int64\n", + "has_driving_kid 267 non-null bool\n", + "home_taz 267 non-null int64\n", + "work_and_school_and_worker 267 non-null bool\n", + "work_and_school_and_student 267 non-null bool\n", + "female 267 non-null bool\n", + "has_preschool_kid_at_home 267 non-null bool\n", + "has_full_time 267 non-null bool\n", + "is_university 267 non-null bool\n", + "max_window 267 non-null int64\n", + "employed_cat 267 non-null object\n", + "student_is_employed 267 non-null bool\n", + "is_gradeschool 267 non-null bool\n", + "is_highschool 267 non-null bool\n", + "has_retiree 267 non-null bool\n", + "cdap_activity 267 non-null object\n", + "num_main_j 267 non-null int64\n", + "num_joint_tours 267 non-null int64\n", + "has_non_worker 267 non-null bool\n", + "ptype_cat 267 non-null object\n", + "is_student 267 non-null bool\n", + "under16_not_at_school 267 non-null bool\n", + "has_school_kid 267 non-null bool\n", + "school_taz 267 non-null float64\n", + "is_worker 267 non-null bool\n", + "roundtrip_auto_time_to_school 267 non-null float64\n", + "distance_to_school 267 non-null float64\n", + "age_16_p 267 non-null bool\n", + "workplace_taz 267 non-null int64\n", + "workplace_in_cbd 267 non-null bool\n", + "has_university 267 non-null bool\n", + "adult 267 non-null bool\n", + "non_mandatory_tour_frequency 164 non-null float64\n", + "nonstudent_to_school 267 non-null bool\n", + "age_16_to_19 267 non-null bool\n", + "num_non_escort_tours 267 non-null float64\n", + "mandatory_tour_frequency 80 non-null object\n", + "num_shop_j 267 non-null int64\n", + "num_mand 267 non-null float64\n", + "num_visi_j 267 non-null int64\n", + "num_escort_tours 267 non-null float64\n", + "roundtrip_auto_time_to_work 267 non-null float64\n", + "num_disc_j 267 non-null int64\n", + "has_part_time 267 non-null bool\n", + "has_school_kid_at_home 267 non-null bool\n", + "distance_to_work 267 non-null float64\n", + "male 267 non-null bool\n", "dtypes: bool(26), float64(9), int64(28), object(5)\n", - "memory usage: 88.5 KB\n" + "memory usage: 96.5 KB\n" ] } ], - "prompt_number": 18 + "prompt_number": 19 }, { "cell_type": "heading", @@ -1397,7 +1366,17 @@ "input": [], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 19 }, { "cell_type": "code",