Esempio n. 1
0
def report():
    print "\nNumber of runs: {0!s}\n".format(sys.argv[2])
    print "\t Gen. \t Nodes \t Conn. \t Evals. \t Score \n"
    print "average  {0:3.2f} \t {1:2.2f} \t {2:2.2f} \t {3:2.2f} \t {4:2.2f}".format(
        mean(total_gens), mean(total_nodes), mean(total_conns),
        mean(total_evals), mean(total_score))
    print "stdev    {0:3.2f} \t {1:2.2f} \t {2:2.2f} \t {3:2.2f} \t {4:2.2f}".format(
        stdev(total_gens), stdev(total_nodes), stdev(total_conns),
        stdev(total_evals), stdev(total_score))
Esempio n. 2
0
    def get_average_fitness(self):
        """Get the per-generation average fitness."""
        avg_fitness = []
        for stats in self.generation_statistics:
            scores = []
            for fitness in stats.values():
                scores.extend(fitness)
            avg_fitness.append(mean(scores))

        return avg_fitness
Esempio n. 3
0
 def post_evaluate(self, population, species, best):
     fit_mean = mean([c.fitness for c in population])
     fit_std = stdev([c.fitness for c in population])
     print('Population\'s average fitness: {0:3.5f} stdev: {1:3.5f}'.format(fit_mean, fit_std))
     print('Best fitness: {0:3.5f} - size: {1!r} - species {2} - id {3}'.format(best.fitness, best.size(),
                                                                                best.species_id, best.ID))
     print('Species length: {0:d} totaling {1:d} individuals'.format(len(species), sum(
         [len(s.members) for s in species])))
     print('Species ID       : {0!s}'.format([s.ID for s in species]))
     print('Species size     : {0!s}'.format([len(s.members) for s in species]))
     print('Species age      : {0}'.format([s.age for s in species]))
Esempio n. 4
0
def get_species_fitness(population, null_value=''):
    all_species = set()
    for gen_data in population.generation_statistics:
        all_species = all_species.union(gen_data.keys())

    max_species = max(all_species)
    species_fitness = []
    for gen_data in population.generation_statistics:
        member_fitness = [gen_data.get(sid, []) for sid in range(1, max_species + 1)]
        fitness = []
        for mf in member_fitness:
            if mf:
                fitness.append(mean(mf))
            else:
                fitness.append(null_value)
        species_fitness.append(fitness)

    return species_fitness
Esempio n. 5
0
def get_species_fitness(population, null_value=''):
    all_species = set()
    for gen_data in population.generation_statistics:
        all_species = all_species.union(gen_data.keys())

    max_species = max(all_species)
    species_fitness = []
    for gen_data in population.generation_statistics:
        member_fitness = [
            gen_data.get(sid, []) for sid in range(1, max_species + 1)
        ]
        fitness = []
        for mf in member_fitness:
            if mf:
                fitness.append(mean(mf))
            else:
                fitness.append(null_value)
        species_fitness.append(fitness)

    return species_fitness
Esempio n. 6
0
def report():
    print "\nNumber of runs: {0!s}\n".format(sys.argv[2])
    print "\t Gen. \t Nodes \t Conn. \t Evals. \t Score \n"
    print "average  {0:3.2f} \t {1:2.2f} \t {2:2.2f} \t {3:2.2f} \t {4:2.2f}".format(mean(total_gens), mean(total_nodes), mean(total_conns), mean(total_evals), mean(total_score))
    print "stdev    {0:3.2f} \t {1:2.2f} \t {2:2.2f} \t {3:2.2f} \t {4:2.2f}".format(stdev(total_gens), stdev(total_nodes), stdev(total_conns), stdev(total_evals), stdev(total_score))
Esempio n. 7
0
def species_mean_fitness(species):
    return mean([m.fitness for m in species.members])
Esempio n. 8
0
def species_mean_fitness(species):
    return mean([m.fitness for m in species.members])