Generalized1NormGenomicSelection#
- class pybrops.breed.prot.sel.UnconstrainedGeneralized1NormGenomicSelection.Generalized1NormGenomicSelection(nparent, ncross, nprogeny, weight=<function weight_absolute>, target=<function target_positive>, method='single', objfn_trans=None, objfn_trans_kwargs=None, objfn_wt=-1.0, ndset_trans=None, ndset_trans_kwargs=None, ndset_wt=-1.0, rng=RandomState(MT19937) at 0x7F8D0DF4C840, soalgo=None, moalgo=None, **kwargs)[source]#
Bases:
UnconstrainedSelectionProtocol
docstring for Generalized1NormGenomicSelection.
Constructor for Generalized1NormGenomicSelection.
- Parameters:
nparent (int) – Number of parents to select.
Methods
Return an objective function for the provided datasets.
Score a parent selection vector according to its distance from a utopian point.
Return a vectorized objective function.
Score a parent selection vector according to its distance from a utopian point.
Calculate a Pareto frontier for objectives.
Select parents individuals for breeding.
Attributes
Selection method.
Multi-objective opimization algorithm.
Number of crosses per configuration.
Nondominated set transformation function.
Nondominated set transformation function keyword arguments.
Nondominated set weights.
Number of parents to select.
Number of progeny to derive from each cross configuration.
Objective function transformation function.
Objective function transformation function keyword arguments.
Objective function weights.
Random number generator source.
Single objective optimization algorithm.
Allele frequency targets or allele frequency target function.
Marker weights or marker weight function.
- property method: str#
Selection method.
- property moalgo: UnconstrainedOptimizationAlgorithm#
Multi-objective opimization algorithm.
- property ncross: int#
Number of crosses per configuration.
- property ndset_trans: Callable | None#
Nondominated set transformation function.
- property ndset_trans_kwargs: dict#
Nondominated set transformation function keyword arguments.
- property ndset_wt: float | ndarray#
Nondominated set weights.
- property nparent: int#
Number of parents to select.
- property nprogeny: int#
Number of progeny to derive from each cross configuration.
- objfn(pgmat, gmat, ptdf, bvmat, gpmod, t_cur, t_max, **kwargs)[source]#
Return an objective function for the provided datasets.
- Parameters:
pgmat (PhasedGenotypeMatrix) – Input phased genotype matrix containing genomes.
gmat (GenotypeMatrix) – Input genotype matrix.
ptdf (pandas.DataFrame) – Not used by this function.
bvmat (BreedingValueMatrix) – Input breeding value matrix.
gpmod (LinearGenomicModel) – Linear genomic prediction model.
- Returns:
outfn – A selection objective function for the specified problem.
- Return type:
function
- static objfn_static(sel, V, trans, kwargs)[source]#
Score a parent selection vector according to its distance from a utopian point. The goal is to minimize this function.
- Parameters:
sel (numpy.ndarray) –
A selection indices matrix of shape
(k,)
.Where:
k
is the number of individuals to select.
Each index indicates which individuals to select. Each index in
sel
represents a single individual’s row.V (numpy.ndarray) –
A matrix of shape
(n,p,t)
containing distance values of individuals’ alleles for each trait.Where:
n
is the number of individuals.p
is the number of markers.t
is the number of traits.
trans (function or callable) –
A transformation operator to alter the output. Function must adhere to the following standard:
Must accept a single
numpy.ndarray
argument.Must return a single object, whether scalar or
numpy.ndarray
.
kwargs (dict) – Dictionary of keyword arguments to pass to
trans
function.
- Returns:
dist – A matrix of shape
(t,)
iftrans
isNone
.Distances for each target.
Where:
t
is the number of traits.
- Return type:
numpy.ndarray
- property objfn_trans: Callable | None#
Objective function transformation function.
- property objfn_trans_kwargs: dict#
Objective function transformation function keyword arguments.
- objfn_vec(pgmat, gmat, ptdf, bvmat, gpmod, t_cur, t_max, **kwargs)[source]#
Return a vectorized objective function.
- static objfn_vec_static(sel, V, trans, kwargs)[source]#
Score a parent selection vector according to its distance from a utopian point. The goal is to minimize this function.
- Parameters:
sel (numpy.ndarray) –
A selection indices matrix of shape
(j,k)
.Where:
j
is the number of configurations to score.k
is the number of individuals to select.
Each index indicates which individuals to select. Each index in
sel
represents a single individual’s row.sel
cannot beNone
.V (numpy.ndarray) –
A matrix of shape
(n,p,t)
containing distance values of individuals’ alleles for each trait.Where:
n
is the number of individuals.p
is the number of markers.t
is the number of traits.
trans (function or callable) –
A transformation operator to alter the output. Function must adhere to the following standard:
Must accept a single
numpy.ndarray
argument.Must return a single object, whether scalar or
numpy.ndarray
.
kwargs (dict) – Dictionary of keyword arguments to pass to
trans
function.
- Returns:
dist – A matrix of shape
(j,t)
iftrans
isNone
.Distances for each target.
Where:
t
is the number of traits.
- Return type:
numpy.ndarray
- property objfn_wt: float | ndarray#
Objective function weights.
- pareto(pgmat, gmat, ptdf, bvmat, gpmod, t_cur, t_max, miscout=None, **kwargs)[source]#
Calculate a Pareto frontier for objectives.
- Parameters:
pgmat (PhasedGenotypeMatrix) – Genomes
gmat (GenotypeMatrix) – Genotypes
ptdf (pandas.DataFrame) – Phenotype dataframe
bvmat (BreedingValueMatrix) – Breeding value matrix
gpmod (GenomicModel) – Genomic prediction model
t_cur (int) – Current generation number.
t_max (int) – Maximum (deadline) generation number.
kwargs (dict) – Additional keyword arguments.
- Returns:
out – A tuple containing two objects
(frontier, sel_config)
.Where:
frontier
is anumpy.ndarray
of shape(q,v)
containing Pareto frontier points.sel_config
is anumpy.ndarray
of shape(q,k)
containing parent selection decisions for each corresponding point in the Pareto frontier.
Where:
q
is the number of points in the frontier.v
is the number of objectives for the frontier.k
is the number of search space decision variables.
- Return type:
tuple
- property rng: Generator | RandomState#
Random number generator source.
- select(pgmat, gmat, ptdf, bvmat, gpmod, t_cur, t_max, miscout=None, **kwargs)[source]#
Select parents individuals for breeding.
- Parameters:
pgmat (PhasedGenotypeMatrix) – Genomes
gmat (GenotypeMatrix) – Genotypes
ptdf (pandas.DataFrame) – Phenotype dataframe
bvmat (BreedingValueMatrix) – Breeding value matrix
gpmod (GenomicModel) – Genomic prediction model
t_cur (int) – Current generation number.
t_max (int) – Maximum (deadline) generation number.
miscout (dict, None, default = None) – Pointer to a dictionary for miscellaneous user defined output. If
dict
, write to dict (may overwrite previously defined fields). IfNone
, user defined output is not calculated or stored.kwargs (dict) – Additional keyword arguments.
- Returns:
out – A tuple containing four objects:
(pgmat, sel, ncross, nprogeny)
.Where:
pgmat
is a PhasedGenotypeMatrix of parental candidates.sel
is anumpy.ndarray
of indices specifying a cross pattern. Each index corresponds to an individual inpgmat
.ncross
is anumpy.ndarray
specifying the number of crosses to perform per cross pattern.nprogeny
is anumpy.ndarray
specifying the number of progeny to generate per cross.
- Return type:
tuple
- property soalgo: UnconstrainedOptimizationAlgorithm#
Single objective optimization algorithm.
- property target: ndarray | Callable#
Allele frequency targets or allele frequency target function.
- property weight: ndarray | Callable#
Marker weights or marker weight function.