tracts.core.optimize_cob_sex_biased_single_step#
- optimize_cob_sex_biased_single_step(p0, population, model_func, parameter_handler, outofbounds_fun=None, verbose_log=0, verbose_screen=10, p_dict=None, exclude_tracts_below_cM=0, maxiter=None, reset_counter=True, ad_model_autosomes='DC', ad_model_allosomes='DC', npts=50)#
Optimizes the log-likelihood over all parameters defined by the demographic model, given a specified pair of admixture models for autosomes and allosomes. The optimization is carried out jointly in a single step, estimating all parameters simultaneously using both autosomal and allosomal data.
- Parameters:
p0 (
list) – An array of initial parameters to start the optimization.population (
Population) – A Population object containing the data to fit.model_func (
callable) – A function that takes a parameter array and returns a dictionary of migration matrices for each population.parameter_handler (
FixedParametersHandler) – An object that handles parameter transformations and fixed parameters.outofbounds_fun (
callable) – A function that takes a parameter array and returns a violation score indicating how much the parameters violate the bounds.verbose_log (
int) – If greater than zero, logs optimization status everyverboseiterations.verbose_screen (
int) – If greater than zero, prints optimization status everyverboseiterations.p_dict (
dict) – A dictionary mapping population labels to their corresponding indices in the model.exclude_tracts_below_cM (
float) – Minimum tract length in centimorgans to exclude from analysis. Default is 0.maxiter (
int) – Maximum iterations to run for.reset_counter (
bool) – Resets the iteration counter to zero. Set to False to continue iteration count (e.g., if optimization continues from previous point).ad_model_autosomes (
str) – 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) – The model to use for allosomal admixture. Must be one of ‘DC’, ‘DF’, ‘H-DC’ or ‘H-DF’. Default is ‘DC’. If None, allosomal admixture will not be modeled.npts (
int) – Number of bins for the tract length histogram. Default is 50.
- Returns:
A tuple containing the optimal parameters found and the corresponding likelihood.
- Return type:
tuple[ndarray,float]