Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,18 @@ A technical memorandum describing DEMOS is available [here](./DEMOS_Technical_Me
### Docker Compose (recommended)
The latest docker image for demos is stored in `ghcr.io/NatLabRockies/demos:latest`. The input data and configuration file are fed to the container through volumes ([more info about Docker volumes](https://docs.docker.com/engine/storage/volumes/)). We provide a `docker-compose` workflow that can be used to make the process of mounting volumes easier.

#### Prepare the configuration file and data folder
#### Clone this repository
By cloning this repository you download the configuration and data for an example run of DEMOS.

Run the following command in the Terminal App (MacOS) or Command Prompt/PowerShell (Windows):

```bash
# Create a directory where to run DEMOS from
mkdir demos
cd demos

# Create the configuration folder and retrieve an example configuration
mkdir configuration
cd configuration
curl -L -o demos_config.toml https://raw.githubusercontent.com/NatLabRockies/DEMOS/main/configuration/demos_config_sfbay.toml

# Create the data folder for the output to be stored
cd ..
mkdir data
# Populate the data folder

# Finally, retrieve the docker-compose.yml file
curl -L -o docker-compose.yml https://raw.githubusercontent.com/NatLabRockies/DEMOS/main/docker-compose.yml
git clone https://github.com/NatLabRockies/DEMOS.git

# Move into the project folder
cd DEMOS

# This folder contains (among other files) a data and configuration folder
# as well as a docker-compose.yml file
```

Make sure you have [Docker](https://docs.docker.com/desktop/) and [Docker Compose](https://docs.docker.com/compose/install/) installed. Now you can run docker as follows:
Expand Down
35 changes: 18 additions & 17 deletions configuration/demos_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
random_seed = 100
base_year = 2010
forecast_year = 2019
calibrated_models_dir = "../data/sf_bay_example/calibrated_models_coefficients/"
calibrated_models_dir = "../data/small_example/calibrated_models_coefficients/"
inconsistent_persons_table_behavior = "fix"
modules = [
"aging",
Expand All @@ -26,38 +26,40 @@ initialize_empty_tables = [
"rebalanced_households"
]


# Data sources

## Synthetic population data
[[tables]]
file_type = "h5"
table_name = "persons"
filepath = "../data/sf_bay_example/custom_mpo_06197001_model_data.h5"
filepath = "../data/small_example/small_example_tables.h5" # custom_mpo_06197001_model_data_small.h5, minihh.h5, custom_mpo_06197001_model_data_small_stratHH.h5, custom_mpo_06197001_model_data_hh0.05.h5, countyNM.h5
h5_key = "persons"

[[tables]]
file_type = "h5"
table_name = "households"
filepath = "../data/sf_bay_example/custom_mpo_06197001_model_data.h5"
filepath = "../data/small_example/small_example_tables.h5" # custom_mpo_06197001_model_data_small.h5, minihh.h5, custom_mpo_06197001_model_data_hh0.05.h5, custom_mpo_06197001_model_data_county1, countyNM.h5
h5_key = "households"

## Other static data tables
[[tables]]
file_type = "csv"
table_name = "relational_adjustment_mapping"
filepath = "../data/sf_bay_example/relmap_06197001.csv"
filepath = "../data/small_example/relmap_06197001.csv"
index_col = "index"

[[tables]]
file_type = "csv"
table_name = "income_rates"
filepath = "../data/sf_bay_example/observed_calibration_values/income_rates_06197001.csv"
filepath = "../data/small_example/observed_calibration_values/income_rates_06197001.csv"
index_col = "year"
custom_dtype_casting = {"lcm_county_id" = "object", "year" = "int", "rate" = "float"}

[[tables]]
file_type = "csv"
table_name = "hsize_ct"
filepath = "../data/sf_bay_example/observed_calibration_values/hsize_ct_06197001.csv"
filepath = "../data/small_example/observed_calibration_values/hsize_ct_06197001_4155.csv"
index_col = "year"
custom_dtype_casting = {"lcm_county_id" = "object", "year" = "int", "hh_size" = "object", "total_number_of_households" = "int"}

Expand All @@ -67,13 +69,13 @@ custom_dtype_casting = {"lcm_county_id" = "object", "year" = "int", "hh_size" =
[[tables]]
file_type = "csv"
table_name = "observed_employment"
filepath = "../data/sf_bay_example/observed_calibration_values/employment_obs.csv"
filepath = "../data/small_example/observed_calibration_values/employment_obs_county.csv"
index_col = "year"

[[tables]]
file_type = "csv"
table_name = "observed_marrital_data"
filepath = "../data/sf_bay_example/observed_calibration_values/marrital_status_over_time_obs.csv"
filepath = "../data/small_example/observed_calibration_values/marrital_status_over_time_obs_county.csv"
index_col = "year"


Expand All @@ -88,24 +90,24 @@ momentum_weight = 0.3
[mortality_module_config.calibration_procedure]
procedure_type = "rmse_error"
tolerance_type = "absolute"
tolerance = 1000
max_iter = 1000
tolerance = 30
max_iter = 500
[mortality_module_config.calibration_procedure.observed_values_table]
file_type = "csv"
table_name = "observed_fatalities_data"
filepath = "../data/sf_bay_example/observed_calibration_values/mortalities_over_time_obs.csv"
filepath = "../data/small_example/observed_calibration_values/mortalities_over_time_obs_county2.csv"
index_col = "year"

## Birth
[birth_module_config.calibration_procedure]
procedure_type = "rmse_error"
tolerance_type = "absolute"
tolerance = 1000
tolerance = 60 # lower
max_iter = 1000
[birth_module_config.calibration_procedure.observed_values_table]
file_type = "csv"
table_name = "observed_births_data"
filepath = "../data/sf_bay_example/observed_calibration_values/births_over_time_obs.csv"
filepath = "../data/small_example/observed_calibration_values/births_over_time_obs_county2.csv"
index_col = "year"

## HH Reorg
Expand All @@ -115,7 +117,7 @@ geoid_col = "lcm_county_id"
[hh_reorg_module_config.simultaneous_calibration_config]
tolerance = 5_000
max_iter = 100
learning_rate = 2.5
learning_rate = 1.5
momentum_weight = 0.3

## HH Rebalancing
Expand All @@ -128,6 +130,5 @@ geoid_col = "lcm_county_id"
[kids_moving_module_config]
geoid_col = "lcm_county_id"
calibration_target_share = 0.12
calibration_tolerance = 0.001


calibration_tolerance = 0.01
max_iter = 100
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,7 @@ geoid_col = "lcm_county_id"
# Kids Moving
[kids_moving_module_config]
geoid_col = "lcm_county_id"
calibration_target_share = 0.12
calibration_tolerance = 0.001


7 changes: 5 additions & 2 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
*
**.h5
!.gitignore
!calibrated_values/
!calibrated_values/**
!calibrated_configs/
!calibrated_configs/**
!sf_bay_example/
!sf_bay_example/**
**/.DS_Store
**.h5
!small_example/
!small_example/**
!small_example/*.h5
**/.DS_Store

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions data/sf_bay_example/observed_calibration_values/employment_obs.csv

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading