コード例 #1
0
 def output(self, gen):
     """Save the higest fitness member of the population to a file"""
     if self.dump_to_files:
         self.sort_by_fitness()
         member = self.members[-1]
         ann_io.save(member.ann, self.outputfolder + curbest_filename)
コード例 #2
0
ファイル: train_to_file.py プロジェクト: sn0ri/evofab
from ann import Network
from ann_trainer import AnnTrainer
import ann_io
import sys
from os import listdir
from os.path import isfile, join

ann_extension = '.ann'

outputfile = sys.argv[1]
iterations = int(sys.argv[2])
training_dir = sys.argv[3]

files = [ join(training_dir, f) for f in listdir(training_dir) if isfile(join(training_dir, f)) ]

n = Network(9, 7, 4)
trainer = AnnTrainer()
trainer.train(n, files, iterations)
ann_io.save(n, outputfile + '.ann')
コード例 #3
0
ファイル: ann_genetic_algorithms.py プロジェクト: fcjr/evofab
 def output(self, gen):
     if self.dump_to_files:
         self.sort_by_fitness()
         member = self.members[-1]
         ann_io.save(member.ann, self.outputfolder + curbest_filename)