Beispiel #1
0
    def _register_variants(self, rebuild_grammar=True):
        clear_all_experiments()

        if rebuild_grammar:
            for experiment_name, experiment in self.experiment_db.get_all():
                Grammar.construct(experiment['grammar_version'],
                                  experiment['function_provider'],
                                  experiment['experiment_id'])

        self.run_evolution.variants = OrderedDict(
        )  # for some reason, Artemis doesn't clear this

        for experiment_name, experiment in self.experiment_db.get_all():
            self.run_evolution.add_variant(variant_name=experiment_name,
                                           **experiment)
        self.variants = self.run_evolution.get_variants()
Beispiel #2
0
 def build_genetic_program(data, function_provider, db_record):
     grammar = Grammar.construct(
         grammar_name=db_record['grammar_version'],
         function_provider=function_provider,
         ephemeral_suffix=db_record['experiment_id'])
     genetic_program = GeneticProgram(
         data_collection=data,
         function_provider=function_provider,
         grammar=grammar,
         fitness_function=db_record['fitness_function'],
         tree_depth=db_record['tree_depth'],
         order_generator=db_record['order_generator'])
     return genetic_program
Beispiel #3
0
 def run_evolution(experiment_id, data, function_provider, grammar_version,
                   fitness_function, mating_prob, mutation_prob,
                   population_size, num_generations, premade_individuals,
                   order_generator, tree_depth, reseed_params):
     grammar = Grammar.construct(grammar_version,
                                 function_provider,
                                 ephemeral_suffix=experiment_id)
     genetic_program = GeneticProgram(
         data_collection=data,
         function_provider=function_provider,
         grammar=grammar,
         fitness_function=fitness_function,
         premade_individuals=premade_individuals,
         order_generator=order_generator,
         tree_depth=tree_depth,
         reseed_params=reseed_params)
     hof, best = genetic_program.evolve(mating_prob,
                                        mutation_prob,
                                        population_size,
                                        num_generations,
                                        verbose=False)
     return hof, best