tracts.driver_utils._get_params_for_newly_explicit_population#

_get_params_for_newly_explicit_population(old_demographic_model, new_demographic_model, remainder_params, near_one)#

When switching the implicit population, the population that was previously implicit becomes an explicit, directly-optimized parameter in the new demographic model, with no starting value specified in the driver file (it was never optimized before, so the user never had to provide one), taken from the optimal remainder values computed at the end of the previous optimization (see compute_remainder_params).

The rate is only used as a starting value (it was not itself flagged as a boundary hit, so it remains free to be optimized). The sex-bias parameter, however, is the very one whose derived (remainder) value was at the +-1 boundary that triggered this implicit-population switch in the first place: per run_boundary_reoptimization’s “all boundary-hitting parameters must be fixed by value” rule, it must be fixed in the new model rather than left free to be resampled/re-optimized from scratch, at +-near_one rather than its actual (possibly less extreme) boundary value.

Parameters:
  • old_demographic_model (ParametrizedDemographySexBiased) – The demographic model before the implicit-population switch.

  • new_demographic_model (ParametrizedDemographySexBiased) – The demographic model after the implicit-population switch (freshly reloaded).

  • remainder_params (dict[str, float]) – The remainder (derived) parameters computed from the previous optimization’s optimal parameters, as returned by compute_remainder_params.

  • near_one (float) – The value (just under 1) to fix the newly-explicit sex-bias parameter at, signed to match which boundary (+1 or -1) it was at. See InferenceConfig.optim.near_one.

Returns:

A pair (start_param_updates, fixed_param_values): a dict mapping the newly-explicit rate parameter name to its starting value, and a dict fixing the newly-explicit sex-bias parameter name at +-near_one.

Return type:

tuple[dict[str, float], dict[str, float]]