geneticengine.algorithms.gp.operators.selection =============================================== .. py:module:: geneticengine.algorithms.gp.operators.selection Classes ------- .. autoapisummary:: geneticengine.algorithms.gp.operators.selection.TournamentSelection geneticengine.algorithms.gp.operators.selection.LexicaseSelection geneticengine.algorithms.gp.operators.selection.WeightedLexicaseSelection geneticengine.algorithms.gp.operators.selection.PriorityLexicaseSelection geneticengine.algorithms.gp.operators.selection.InformedDownsamplingSelection Module Contents --------------- .. py:class:: TournamentSelection(tournament_size, with_replacement = False) Bases: :py:obj:`geneticengine.algorithms.gp.structure.GeneticStep` TournamentSelection represents a tournament selection algorithm, where tournament_size individuals are selected at random, and only the best passes to the next generation. :param tournament_size: number of individuals from the population that will be randomly selected :type tournament_size: int :param with_replacement: whether the selected individuals can appear again in another tournament (default: False) :type with_replacement: bool .. py:attribute:: tournament_size .. py:attribute:: with_replacement :value: False .. py:method:: iterate(problem, evaluator, representation, random, population, target_size, generation) .. py:class:: LexicaseSelection(epsilon = False) Bases: :py:obj:`geneticengine.algorithms.gp.structure.GeneticStep` Implements Lexicase Selection (http://williamlacava.com/research/lexicase/). :param epsilon: if True, espilon-lexicase is performed. We use the method given by equation 5 in https://dl.acm.org/doi/pdf/10.1145/2908812.2908898. .. py:attribute:: epsilon :value: False .. py:method:: iterate(problem, evaluator, representation, random, population, target_size, generation) .. py:class:: WeightedLexicaseSelection(epsilon = True, objective_weights = None) Bases: :py:obj:`LexicaseSelection` Lexicase selection with accuracy-biased objective ordering. Uses weighted random permutation: - Objectives [0,1,2] (accuracy splits): weight 4.0 each - Objectives [3,4] (costs): weight 1.0 each :param epsilon: if True, espilon-lexicase is performed. We use the method given by equation 5 in https://dl.acm.org/doi/pdf/10.1145/2908812.2908898. .. py:attribute:: objective_weights :value: None .. py:method:: _weighted_case_order(random, n_cases) .. py:method:: iterate(problem, evaluator, representation, random, population, target_size, generation) .. py:class:: PriorityLexicaseSelection(epsilon = True, objective_priorities = None) Bases: :py:obj:`LexicaseSelection` Priority Lexicase: - Lower integer means higher priority - Objectives in the same priority level are shuffled. Example: objective_priorities=[1, 1, 2, 3] -> [0/1 shuffled], then 2, then 3. :param epsilon: if True, espilon-lexicase is performed. We use the method given by equation 5 in https://dl.acm.org/doi/pdf/10.1145/2908812.2908898. .. py:attribute:: objective_priorities :value: None .. py:method:: _priority_case_order(random, n_cases) .. py:method:: iterate(problem, evaluator, representation, random, population, target_size, generation) .. py:class:: InformedDownsamplingSelection(max_sample_size = 10, percent = 0.1) Bases: :py:obj:`geneticengine.algorithms.gp.structure.GeneticStep` Selects individuals using only test cases with highest variance. Faster than standard Lexicase by reducing test case evaluations. .. py:attribute:: max_sample_size :value: 10 .. py:attribute:: percent :value: 0.1 .. py:method:: iterate(problem, evaluator, representation, random, population, target_size, generation)