tracts.driver.run_optimization#
- run_optimization(physical_start_params, genetic_model, population, driver_spec, likelihood_options, model_param_names, sex_bias_param_names, print_run_details=True)#
Runs the optimization (single-step, or two-step with the step 1 / step 2 / step-2-skipped branches) given a list of starting parameters in physical units, returning the optimal parameters and the corresponding likelihood.
- Parameters:
physical_start_params (
list) – Starting parameter sets, in physical units, to start the optimization from (one optimization run per entry).genetic_model (
GeneticModel) – Bundles the demographic model being fit (accessible asgenetic_model.demographic_model, which also providesparameter_handlerfor unit conversions and fixed-parameter state) with the admixture and phase-type model configuration used to compute the likelihood.population (
Population) – The population object containing the data to fit.driver_spec (InferenceConfig) – The parsed driver-file configuration; controls whether a single-step or two-step optimization is run, and its iteration/verbosity settings.
likelihood_options (
LikelihoodOptions) – Logging verbosity for this run. Itsinclude_autosomes/include_allosomesflags are ignored here: which data are included is determined per step, as inoptimize_cob_sex_biased_two_steps().model_param_names (
list) – Names of all of the demographic model’s free base parameters, in order.sex_bias_param_names (
list) – Names of the sex-bias parameters amongmodel_param_names.print_run_details (
bool) – Whether to print the starting-parameters table under each step’s header, the “Optimization run #N” line, and the step-transition messages (“Selecting best parameters from step X…”). The step headers themselves and the optimizer’s own iteration table are always printed. Set to False for quick, low-noise repeated re-optimizations (e.g.run_sex_bias_fixing_reoptimizations) where only one run per step is performed and these details add clutter rather than information. Defaults to True.
- Returns:
The optimal parameters found (in physical units) and the corresponding likelihood.
- Return type:
tuple