def AddConfig(self, p_sConfigFileName=None): if p_sConfigFileName is None: sSourceFileName = self.TemplateConfigFileName else: sSourceFileName = p_sConfigFileName _, sName, _ = Storage.SplitFileName(sSourceFileName) # Gets the current run/evaluation counter nCounter = self.__readCounter() oConfig = NNLearnConfig() oConfig.LoadFromFile(sSourceFileName) sDestFileNames = None if oConfig.LearningRateSequence is not None: nCounter, sDestFileNames = self.__sequenceLearningRate( sSourceFileName, oConfig.LearningRateSequence, nCounter) elif oConfig.FoldSequence is not None: nCounter, sDestFileNames = self.__sequenceFoldNumber( sSourceFileName, oConfig.FoldSequence, nCounter) # for nFoldNumber in oConfig.FoldSequence: # oNewConfig = NNLearnConfig() # oNewConfig.LoadFromFile(sSourceFileName) # oNewConfig.FoldNumber = nFoldNumber # sDestFileName = Storage.JoinFileName(self.PendingFolder, "%.3d-" % nCounter + sName, ".cfg") # oNewConfig.SaveToFile(sDestFileName) # nCounter += 1 else: sDestFileNames = [ Storage.JoinFileName(self.PendingFolder, "%.3d-" % nCounter + sName, ".cfg") ] Storage.CopyFile(sSourceFileName, sDestFileNames[0]) nCounter += 1 # Saves the current run/evaluation counter self.__writeCounter() return sDestFileNames
def Activate(self): """ Returns True : If a new experiment folder is created and the configuration was copied there False: If an existing experiment folder is reused """ assert self.LearnConfig is not None, "Method requires a learn configuration." if self.LearnConfig.SavedExperimentUID is not None: self.Open(self.LearnConfig.FoldNumber, self.LearnConfig.SavedExperimentUID) bMustArchive = False else: if self.LearnConfig.IsTraining: self.Begin() # Copies the source configuration file to the experiment subfolder "config" Storage.CopyFile(self.LearnConfig.FileName, self.RunSub.LearnConfigFileName, True) bMustArchive = True else: self.Open() bMustArchive = False return bMustArchive