[docs]defsaveInitialNetwork(self,template):"""Saves the network at the state after construction."""# TODO 2014-07-08: Check if this method is really necessaryself.initialNetwork.save(template)

[docs]defsaveCurrentNetwork(self,template):"""Saves the network at the current state."""self.network.save(template)

[docs]classFFNetworkFactory:"""Reads the initial weights of the storage files and returns a FFNetworkAdapter based on them."""def__init__(self,folder):"""folder is the folder in which the neural networks are to be stored."""self.folder=folder

[docs]defsaveNetwork(self,network,name,folder,uniqueIdentifier):""" Saves the network with the given name in the given folder. Parameters: network -- the network to save name -- the name of the network folder -- folder in which to store the network uniqueIdentifier -- an identifier for this particular network, e.g. the replication number """path="%s/r%s"%(folder,uniqueIdentifier)try:os.makedirs(path)exceptOSError:# documentation says: raised if file already existspassnetwork.saveCurrentNetwork("%s/%s_{0}"%(path,name))