tracts.driver.run_model_multi_init#
- run_model_multi_init(model_func, bound_func, population, population_labels, start_params_list, population_dict, parameter_handler=None, max_iter=None, exclude_tracts_below_cM=0, ad_model_autosomes='DC', ad_model_allosomes='DC', npts=50, verbose_log=0, verbose_screen=0, two_steps_optimization=True, run_optimize_cob=False)#
Runs the model multiple times with different initial parameters.
- Parameters:
model_func (
Callable) – A function that takes parameters and returns migration matrices.bound_func (
Callable) – A function that calculates the violation score for the parameters.population (
Population) – The population object containing individual data.population_labels (
list[str]) – A list of labels corresponding to the populations.start_params_list (
list[ndarray]) – A list of initial parameter arrays to start the optimization.population_dict (
dict) – A dictionary mapping population labels to their corresponding indices in the model.parameter_handler (ParameterHandler, optional) – An object that handles parameter transformations and fixed parameters. Default is None.
max_iter (
int) – Maximum number of iterations for the optimization algorithm. Default is None, which means no limit.exclude_tracts_below_cM (
int) – Minimum tract length in centimorgans to exclude from analysis. Default is 0.ad_model_autosomes (str, optional) – The model to use for autosomal admixture. Must be one of ‘DC’, ‘DF’, ‘M’, ‘H-DC’ or ‘H-DF’. Default is ‘DC’.
ad_model_allosomes (str or None, optional) – The model to use for allosomal admixture. Must be one of ‘DC’, ‘DF’, ‘H-DC’ or ‘H-DF’, or None if allosomal admixture is not to be modeled. Default is ‘DC’.
npts (
int) – Number of bins for the tract length histogram. Default is 50.verbose_log (
int) – Verbosity level for logging. Default is 0 (no verbose output). If greater than 0, iterations are logged everyverbose_logsteps.verbose_screen (
int) – Verbosity level for screen prints. Default is 0 (no verbose output). If greater than 0, iterations are printed everyverbose_screensteps.two_steps_optimization (
bool) – Whether to use a two-step optimization procedure for sex-biased models. Default is True.
- Return type:
tuple[list[ndarray],list[float]]- Returns:
tuple[list[np.ndarray], list[float]] – A tuple containing two lists: (i) a list of optimal parameters found for each set of starting parameters and (ii) a list of likelihoods corresponding to the optimal parameters.