geneticengine.algorithms.gp.operators.weight_learning
Classes
Applies weight learning to the grammar with a given learning rate. |
|
A genetic step that applies weight learning using only individuals |
Module Contents
- class geneticengine.algorithms.gp.operators.weight_learning.WeightLearningStep(learning_rate=0.01)
Bases:
geneticengine.algorithms.gp.structure.GeneticStepApplies weight learning to the grammar with a given learning rate.
- Parameters:
learning_rate (float)
- learning_rate = 0.01
- wrap(representation, genotype)
- Parameters:
representation (geneticengine.representations.api.Representation)
genotype (Any)
- Return type:
- count_productions(individual, g)
- Parameters:
individual (geneticengine.solutions.tree.TreeNode)
- compute_production_probabilities(individuals, g)
Calculates production probabilities by aggregating counts from a list of individuals.
- Parameters:
individuals (Sequence[geneticengine.solutions.individual.Individual])
- iterate(problem, evaluator, representation, random, population, target_size, generation)
- Parameters:
problem (geneticengine.problems.Problem)
evaluator (geneticengine.evaluation.Evaluator)
representation (geneticengine.representations.api.Representation)
population (Iterator[geneticengine.solutions.individual.PhenotypicIndividual])
target_size (int)
generation (int)
- Return type:
Iterator[geneticengine.solutions.individual.PhenotypicIndividual]
- class geneticengine.algorithms.gp.operators.weight_learning.ConditionalWeightLearningStep(fitness_threshold=0.5, weight_learning_rate=0.01)
Bases:
geneticengine.algorithms.gp.structure.GeneticStepA genetic step that applies weight learning using only individuals from the Pareto front that are above a specified fitness threshold.
- Parameters:
fitness_threshold (float) – The minimum average fitness an individual must have to be included in the weight learning process.
weight_learning_rate (float) – The learning rate for the grammar update.
- fitness_threshold = 0.5
- internal_weight_learning_step
- iterate(problem, evaluator, representation, random, population, target_size, generation)
The main iteration logic for the conditional step.
- Parameters:
problem (geneticengine.problems.Problem)
evaluator (geneticengine.evaluation.Evaluator)
representation (geneticengine.representations.api.Representation)
population (Iterator[geneticengine.solutions.individual.PhenotypicIndividual])
target_size (int)
generation (int)
- Return type:
Iterator[geneticengine.solutions.individual.PhenotypicIndividual]