Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address Minor Issues Associated with ARC Update to Develop Branch #342

Merged
merged 27 commits into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3b70dfc
publish v0.9.5 (#340)
bstabler Sep 4, 2020
ff0dff6
Remove duplicate coefficient.
Aug 26, 2020
38ebd38
move coefficient processing up
Aug 27, 2020
bc8864e
Update joint_tour_destination.py
Aug 27, 2020
bd92212
Fix reference to joint tour destination.yaml
Aug 27, 2020
f4a6ffe
Error check for COEFFICIENT files
Aug 25, 2020
db4c296
Add person_id to joint choosers.
Sep 9, 2020
f76f9c0
move notebooks to examples folder so they are installed and update do…
bstabler Sep 10, 2020
4393b5e
Merge branch 'master' into develop
bstabler Sep 10, 2020
152b359
Merge branch 'develop' of https://github.com/ActivitySim/activitysim …
bstabler Sep 10, 2020
fe2614d
publish (#344)
bstabler Sep 10, 2020
2d07a37
correct doc links
bstabler Sep 10, 2020
168ac7c
Remove duplicate coefficient.
Aug 26, 2020
e836af6
move coefficient processing up
Aug 27, 2020
e3aa9e9
Update joint_tour_destination.py
Aug 27, 2020
03b5957
Fix reference to joint tour destination.yaml
Aug 27, 2020
50a2788
Error check for COEFFICIENT files
Aug 25, 2020
99f3bbf
Add person_id to joint choosers.
Sep 9, 2020
834e73b
Merge branch 'hf_bugs' of https://github.com/danielsclint/activitysim…
Sep 10, 2020
200485a
Merge branch 'master' into develop
bstabler Sep 10, 2020
5594997
Remove duplicate coefficient.
Aug 26, 2020
568cd81
move coefficient processing up
Aug 27, 2020
95fc1a2
Update joint_tour_destination.py
Aug 27, 2020
5658578
Fix reference to joint tour destination.yaml
Aug 27, 2020
59fec00
Error check for COEFFICIENT files
Aug 25, 2020
789b678
Add person_id to joint choosers.
Sep 9, 2020
e06f5f0
Merge branch 'hf_bugs' of https://github.com/danielsclint/activitysim…
Sep 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

include ez_setup.py
include README.rst
include LICENSE.txt

graft notebooks
graft activitysim/examples

# required for test system
Expand Down
2 changes: 1 addition & 1 deletion activitysim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ActivitySim
# See full license in LICENSE.txt.

__version__ = '0.9.5'
__version__ = '0.9.5.1'
__doc__ = 'Activity-Based Travel Modeling'
4 changes: 2 additions & 2 deletions activitysim/abm/models/joint_tour_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ def joint_tour_destination(
person that's making the tour)
"""

trace_label = 'non_mandatory_tour_destination'
model_settings_file_name = 'non_mandatory_tour_destination.yaml'
trace_label = 'joint_tour_destination'
model_settings_file_name = 'joint_tour_destination.yaml'
model_settings = config.read_model_settings(model_settings_file_name)

logsum_column_name = model_settings.get('DEST_CHOICE_LOGSUM_COLUMN_NAME')
Expand Down
9 changes: 4 additions & 5 deletions activitysim/abm/models/util/vectorize_tour_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
locals_dict.update(constants)
locals_dict.update(skims)

# constrained coefficients can appear in expressions
coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
locals_dict.update(coefficients)

# - run preprocessor to annotate choosers
# allow specification of alternate preprocessor for nontour choosers
preprocessor = model_settings.get('LOGSUM_PREPROCESSOR', 'preprocessor')
Expand All @@ -92,17 +96,12 @@ def _compute_logsums(alt_tdd, tours_merged, tour_purpose, model_settings, trace_
trace_label=trace_label)

# - compute logsums

coefficients = simulate.get_segment_coefficients(logsum_settings, tour_purpose)
logsum_spec = simulate.read_model_spec(file_name=logsum_settings['SPEC'])
logsum_spec = simulate.eval_coefficients(logsum_spec, coefficients, estimator=None)

nest_spec = config.get_logit_model_settings(logsum_settings)
nest_spec = simulate.eval_nest_coefficients(nest_spec, coefficients)

# constrained coefficients can appear in expressions
locals_dict.update(coefficients)

logsums = simulate.simple_simulate_logsums(
choosers,
logsum_spec,
Expand Down
12 changes: 10 additions & 2 deletions activitysim/core/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def read_model_coefficients(model_settings=None, file_name=None):
file_name = model_settings['COEFFICIENTS']

file_path = config.config_file_path(file_name)
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
try:
coefficients = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
except ValueError:
logger.exception("Coefficient File Invalid: %s" % str(file_path))
raise

return coefficients

Expand Down Expand Up @@ -188,7 +192,11 @@ def read_model_coefficient_template(model_settings):
coeffs_file_name = model_settings['COEFFICIENT_TEMPLATE']

file_path = config.config_file_path(coeffs_file_name)
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
try:
template = pd.read_csv(file_path, comment='#', index_col='coefficient_name')
except ValueError:
logger.exception("Coefficient Template File Invalid: %s" % str(file_path))
raise

# by convention, an empty cell in the template indicates that
# the coefficient name should be propogated to across all segments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ SEGMENTS:
- eatout
- social


SAMPLE_SIZE: 30

# we can't use use household income_segment as this will also be set for non-workers
CHOOSER_SEGMENT_COLUMN_NAME: tour_type

SIMULATE_CHOOSER_COLUMNS:
- tour_type
- TAZ
- household_id
- person_id

LOGSUM_SETTINGS: tour_mode_choice.yaml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coef_mode_logsum,0.6755,F
coef_escort_dist_0_2,-0.1499,F
coef_eatout_dist_0_2,-0.5609,F
coef_eatout_social_0_2,-0.5609,F
coef_eatout_dist_0_2,-0.7841,F
#coef_eatout_dist_0_2,-0.7841,F
coef_othdiscr_dist_0_2,-0.1677,F
coef_escort_dist_2_5,-0.8671,F
coef_shopping_dist_2_5,-0.5655,F
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}
],
"source": [
"!pip install https://github.com/activitysim/activitysim/zipball/develop"
"!pip install activitysim"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/abmexample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,10 @@ To run the estimation example, do the following:

* Open the relevant estimation with larch example Jupyter Notebook and re-estimate the submodel:

* `Estimating auto ownership <https://github.com/activitysim/activitysim/blob/develop/activitysim/examples/example_estimation/notebooks/estimating_auto_ownership.ipynb/>`__
* `Estimating school location <https://github.com/activitysim/activitysim/blob/develop/activitysim/examples/example_estimation/notebooks/estimating_school_location.ipynb/>`__
* `Estimating work location <https://github.com/activitysim/activitysim/blob/develop/activitysim/examples/example_estimation/notebooks/estimating_workplace_location.ipynb/>`__
* `Estimating tour mode choice <https://github.com/activitysim/activitysim/blob/develop/activitysim/examples/example_estimation/notebooks/estimating_tour_mode_choice.ipynb/>`__
* `Estimating auto ownership <https://github.com/activitysim/activitysim/blob/master/activitysim/examples/example_estimation/notebooks/estimating_auto_ownership.ipynb/>`__
* `Estimating school location <https://github.com/activitysim/activitysim/blob/master/activitysim/examples/example_estimation/notebooks/estimating_school_location.ipynb/>`__
* `Estimating work location <https://github.com/activitysim/activitysim/blob/master/activitysim/examples/example_estimation/notebooks/estimating_workplace_location.ipynb/>`__
* `Estimating tour mode choice <https://github.com/activitysim/activitysim/blob/master/activitysim/examples/example_estimation/notebooks/estimating_tour_mode_choice.ipynb/>`__

* Save the updated coefficient file to the configs folder and run the model in simulation mode.

Expand Down
10 changes: 5 additions & 5 deletions docs/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ ActivitySim includes a `Jupyter Notebook <https://jupyter.org>`__ recipe book wi
* Open an Anaconda prompt and activate the Anaconda environment with ActivitySim installed
* If needed, ``conda install jupyterlab`` so you can run jupyter notebooks
* Type ``jupyter notebook`` to launch the web-based notebook manager
* Navigate to the notebooks folder and select a notebook to learn more:
* Navigate to the examples notebooks folder and select a notebook to learn more:

* `Getting started <https://github.com/activitysim/activitysim/blob/develop/notebooks/getting_started.ipynb/>`__
* `Summarizing results <https://github.com/activitysim/activitysim/blob/develop/notebooks/summarizing_results.ipynb/>`__
* `Testing a change in auto ownership <https://github.com/activitysim/activitysim/blob/develop/notebooks/change_in_auto_ownership.ipynb/>`__
* `Adding TNCs <https://github.com/activitysim/activitysim/blob/develop/notebooks/adding_tncs.ipynb/>`__
* `Getting started <https://github.com/ActivitySim/activitysim/blob/master/activitysim/examples/example_mtc/notebooks/getting_started.ipynb/>`__
* `Summarizing results <https://github.com/ActivitySim/activitysim/blob/master/activitysim/examples/example_mtc/notebooks/summarizing_results.ipynb/>`__
* `Testing a change in auto ownership <https://github.com/ActivitySim/activitysim/blob/master/activitysim/examples/example_mtc/notebooks/change_in_auto_ownership.ipynb/>`__
* `Adding TNCs <https://github.com/ActivitySim/activitysim/blob/master/activitysim/examples/example_mtc/notebooks/adding_tncs.ipynb/>`__

Hardware
--------
Expand Down