SEMCOG / semcog_urbansim

7 stars 6 forks source link

Unit-level Simulation #23

Open cvanoli opened 5 years ago

cvanoli commented 5 years ago

Commit: unit_level sampling simulation script

Simulation unit-level script created to simulate a run with unit-level estimated location choice models. Therefore, the hlcms and elms that run are called “hlcm_step_names_lacontrol_unitlevel” and “elcm_step_names_lacontrol_unitlevel”

Commit: unit level lcms yaml files and config

In configs directory, the yaml configs file which lists all the yams files to use as unit level lcms, and the “lcm_unit_level” directory stores each yams file with model specifications for all household and employment location choice models for each large area id and for each sector id or household type id.

Commit: utils function to edit network.yaml files

In utils.py a function was created to edit the networks.yaml files to adapt their configuration to the newest pandana release. The function “_convert_network_columns” performs three tasks. One, it converts the columns from the involved data frames into float types. This is because the pandana network only accepts float columns. Secondly, it also converts the radius number to a float number. Third, if the aggregation type is an average, it changes the word “average” into “ave” which is accepted by the pandana library. Finally, it saves the edited network.yaml to be used afterwards to create the network parameters.

Commit: net.set_pois() update parameters

In variables_access.py the computation of point of interest in done creating a network with pandana library. The new pandana release has changed the parameters for the “net.set_pois()” object, so those were updated to calculate accessibility variables. Pandana function with the parameters

Commit:register unit-level lcms, pandana updates, parcel_utils updates

register unit-level lcms

Lines 48-81 registers the location choice models with large area and unit level specifications. These specifications are saved in “yaml_configs_la_control_unit_level.yaml”. In order to get the speficications from a different file than “yaml_configs.yaml”, the “lcm_utils.get_model_category_configs()” function is modified to accept as an input the yams file where to look for the specs. The default value keeps as “yaml_configs.yaml”. The new unit-level lams steps are called ‘hlcm_step_names_lacontrol_unitlevel' and ‘elcm_step_names_lacontrol_unitlevel’.

pandana updates

The “net.init_pois()” and “pdna.network.reserve_num_graphs(2)” functions are no longer necessary to be initiated with the new pandana release.

URBANSIM_parcel/utils updates

Also, it has been added to “run_feasibility()” a parcel_custom_callback=parcel_custom_callback , which is a function to pass all the parcels parameters to the feasibility function. The parcel_custom_callback is specified in models.py lines 799-807.

Commit: hh_type_id, zonepercent vars, st vars

In variables_demographic logic is added to calculate household_type_id column (18 hh types used as hlcm segments). Besides, in variables_zones clustering variables calculation is added such as “zones_percent_low_income”. Finally, in variablesbuildings.py other clustering variables are added as well as the standardize function to created all the columns that start with “st” that are present in the unit_level specifications.

Commit: remove null x,y and add hh_index

In dataset.py, a logic is added to the buildings table definition to remove all those buildings with null x and y. Also, added the index name to the households table, household_id.

Eh2406 commented 5 years ago

@cvanoli I have started a model run with 8ebf6ac37defb9d907ba522f816eb4c36bcdf83b please let me know if I should scrap it to include your new commits.

Eh2406 commented 5 years ago

I am trying a run with 7d421911e08856ca798b3bf388ccf4b3971e95a1 and https://github.com/SEMCOG/urbansim/commit/79bdc30ce7e66d4e6243592e8f87c406820e4b7d

Eh2406 commented 5 years ago

I can report that it has gotten further than my previous runs!

Eh2406 commented 4 years ago

I seem to have lost track of the change that allows re estimation of these models. What script do I run to estimate new coefficients at a unit level?

cvanoli commented 4 years ago

The script is inside the semcog_test repo. It is a a notebook called "HLCM_Estimation_Unit_level.ipynb"