geneticengine.algorithms.gp.operators.weight_learning

Classes

WeightLearningStep

Applies weight learning to the grammar with a given learning rate.

ConditionalWeightLearningStep

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.GeneticStep

Applies weight learning to the grammar with a given learning rate.

Parameters:

learning_rate (float)

learning_rate = 0.01
wrap(representation, genotype)
Parameters:
Return type:

geneticengine.solutions.individual.PhenotypicIndividual

count_productions(individual, g)
Parameters:
compute_production_probabilities(individuals, g)

Calculates production probabilities by aggregating counts from a list of individuals.

Parameters:
iterate(problem, evaluator, representation, random, population, target_size, generation)
Parameters:
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.GeneticStep

A 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:
Return type:

Iterator[geneticengine.solutions.individual.PhenotypicIndividual]