tracts.driver.run_sex_bias_fixing_reoptimizations#
- run_sex_bias_fixing_reoptimizations(driver_spec, model_param_names, optimal_params, optimal_likelihood, run_optimization_fixed_options)#
Repeats
driver_spec.optim.n_reoptimizationstimes: fixing the sex-bias parameters at their most recently optimized values and re-running the optimization starting from the current optimal parameters (using a copy ofdriver_specwithrepetitions=1and starting parameters set to the current optimum, rebuilt at every repetition, see_get_driver_for_reoptimization; this also means, percore.py, that sex-bias parameters end up fixed only during step 1, remaining free to be optimized again in step 2, which starts from the sex-bias values of the previous repetition). Stops early if the likelihood no longer improves between repetitions. Since only one run per step is performed, each repetition runs withprint_run_details=False(seerun_optimization): step headers and the optimizer’s own iteration table are still shown, but the starting-parameters table, “Optimization run #N” line, and step-transition messages are suppressed.- Parameters:
driver_spec (
InferenceConfig) – The current driver-file configuration; controls the number of repetitions (driver_spec.optim.n_reoptimizations).model_param_names (
list[str]) – Names of all of the current demographic model’s free base parameters, in order.optimal_params (
ndarray) – The current optimal parameters (physical units), before these re-optimizations.optimal_likelihood (
float) – The current optimal likelihood, before these re-optimizations.run_optimization_fixed_options (
Callable) – A partially-appliedrun_optimization(withgenetic_model,population,likelihood_options,model_param_names, andsex_bias_param_namesalready bound), takingphysical_start_paramsanddriver_specas its remaining arguments.
- Returns:
The updated optimal parameters and likelihood after the re-optimization repetitions.
- Return type:
tuple[ndarray,float]