def log_stats(self, generation, population, selected, n_mutated, scores):
"""
Stats to be logged:
Generation : Represant the iteration you're on
mutated : Represent the mutated population
mutation_percent : Percentage of mutation
fitness_ind : Fitness of all individue
group_fitness : Fitness of all groups
population : Population at this time.
score : One score for the Puzzle
record: fitness_ind and fitness_group compiled by stats. (min max avg)
:param generation: The current iteration you're on
:param population: The current population you're using
:param n_mutated: The number of mutated element.
:return:
"""
record = self.stats.compile(population)
self.populations.append(population)
self.logbook.record(generations=generation, mutated=n_mutated, mutation_percent=config.mutate_inpd,
nb_full_connected=len([x for x in population if x.fitness_ind.values[0] == 4]),
connections_completions=scores[0], score=scores[1], selected=selected, **record)
# I case we need to keep famous big scores.
# self.famous.update(self.pop)
评论列表
文章目录