|
| 1 | +# Advanced Options for DEMOS |
| 2 | + |
| 3 | +## Configuration of calibration procedures |
| 4 | + |
| 5 | +Certain modules support calibration of the simulation output to observed values. Specific calibration parameters can be set for each module that supports it. If no configuration is provided, calibration is not performed. |
| 6 | + |
| 7 | +Calibration configuration is defined at `module-level-config.calibration_procedure` (`module-level-config` is defined differently for every module. The options are displayed [here](../api/configuration_module.rst) and in each module's documentation). |
| 8 | + |
| 9 | +For example, in the mortality module configuration we find the following: |
| 10 | + |
| 11 | +```toml |
| 12 | +[mortality_module_config.calibration_procedure] |
| 13 | +procedure_type = "rmse_error" |
| 14 | +tolerance_type = "absolute" |
| 15 | +tolerance = 1000 |
| 16 | +max_iter = 1000 |
| 17 | +[mortality_module_config.calibration_procedure.observed_values_table] |
| 18 | +file_type = "csv" |
| 19 | +table_name = "observed_fatalities_data" |
| 20 | +filepath = "../data/sf_bay_example/observed_calibration_values/mortalities_over_time_obs.csv" |
| 21 | +index_col = "year" |
| 22 | +``` |
| 23 | + |
| 24 | +This section of the configuration file does a couple of things: |
| 25 | +- Sets the procedure type to `rmse_error` (currently the only available option) |
| 26 | +- Sets the Tolerance type to `absolute`. This means that DEMOS will continue to optimize the output until the absolute difference between the current value predicted and the observed is smaller than this tolerance. An alternative value for this parameter is `relative`, which changes the logic to interpret the tolerance value as relative. |
| 27 | +- Sets the tolerance level. If `tolerance_type` is `absolute`, this is an absolute value. Otherwise, this is a percentage |
| 28 | +- Sets the maximum number of iterations |
| 29 | +- Identifies which data to use for validation by assigning a value to `mortality_module_config.calibration_procedure.observed_values_table`. This has the same format as any other table loade d in the `tables` section of the configuration. |
| 30 | + |
| 31 | +If for example you would like to skip calibration on the mortality module, just delete or comment out all these lines corresponding to `mortality_module_config.calibration_procedure`. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +Additionally, some modules (namely `employment` and `household_reorganization`) implement simultaneous calibration. |
| 36 | + |
| 37 | +**If you want to use simultaneous calibration for the `employment` module** |
| 38 | + |
| 39 | +```toml |
| 40 | +[employment_module_config.simultaneous_calibration_config] |
| 41 | +tolerance = 100 |
| 42 | +max_iter = 2 |
| 43 | +learning_rate = 2 |
| 44 | +momentum_weight = 0.3 |
| 45 | +``` |
| 46 | + |
| 47 | +Due to the complexity and nuances of simultaneous calibration, the required tables of observed values (`observed_entering_workforce` and `observed_exiting_workforce`) are hard-coded, and an error will be raised if they are not loaded. |
| 48 | + |
| 49 | +<!-- **If you instead want to use simple calibration** |
| 50 | +
|
| 51 | +We need to define the following: |
| 52 | +```toml |
| 53 | +[employment_module_config.enter_model_calibration_procedure] |
| 54 | +procedure_type = "rmse_error" |
| 55 | +observed_values_table = "observed_entering_workforce" |
| 56 | +tolerance_type = "relative" |
| 57 | +tolerance = 0.01 |
| 58 | +max_iter = 1000 |
| 59 | +
|
| 60 | +[employment_module_config.exit_model_calibration_procedure] |
| 61 | +procedure_type = "rmse_error" |
| 62 | +observed_values_table = "observed_exiting_workforce" |
| 63 | +tolerance_type = "relative" |
| 64 | +tolerance = 0.01 |
| 65 | +max_iter = 1000 |
| 66 | +``` |
| 67 | +
|
| 68 | +This will allow DEMOS to execute calibration on each of the two modules in the employment module. |
| 69 | +
|
| 70 | +**If you want to skip calibration, just delete these entrances from the configuration file.**--> |
| 71 | + |
| 72 | +<!-- See the example config for more options, including output tables, calibration, and module selection. --> |
| 73 | + |
| 74 | +## Selection of modules to run |
| 75 | + |
| 76 | +The `modules` parameter in the configuration file accepts a list of strings identifying the modules. By default all are included, but if you'd like to only run a selection of them you can change it. For instance to run only `aging` and `education`: |
| 77 | +``` |
| 78 | +modules = [ |
| 79 | + "aging", |
| 80 | + "education", |
| 81 | +] |
| 82 | +``` |
0 commit comments