def fitness(self): uow=UnitOfWork() genoWithSegSiz=[geno for geno in self._genomes if geno._genName== 'segment_size'] if genoWithSegSiz==[]: self._shelveDataFile=uow._dataSet().PreparingData() else: segment_size=genoWithSegSiz[0]._value self._shelveDataFile=uow._dataSet.PreparingData(segment_size) cnn=CNN(self._shelveDataFile,self._genomes) self._accuracy=cnn.RunAndAccuracy() return self._accuracy
from DataSet import DataSet import shelve from Genome import Genome from Genetic import Genetic from UnitOfWork import UnitOfWork if __name__ == "__main__": UOF=UnitOfWork() genetic=Genetic(UOF._iteration,UOF._popSize,UOF._perMut,UOF._genomes) print(genetic.Run())