示例#1
0
	def train_network(train):
		""" Wrap around train network, with support for keyboard
		interruption handling"""
		try:
			Network.SGD(train, train.training_data, train.epochs,
							   train.alpha, train.validation_data,
							   train.test_data, train.current_iteration)
		except KeyboardInterrupt:
			print "\nSaving work to the working folder..."
			Network.save_states(train)
			print "Closing..."
示例#2
0
	def new_network(train,  modified_params, modified_layers):
		""" Create a new network, based on the provided information """

		train.parameters = modified_params[3:] 	# exclude dataset information
 		[(_, train.training_data), (_, train.validation_data),
 		 (_, train.test_data), (_, train.mini_batch_size),
 		 (_, train.epochs), (_, train.alpha),
 		 (_, train.lmbda), (_, train.validate)] = modified_params

 		train.current_epoch = 0
 		train.current_iteration = 0

 		exec train.construct_layers(modified_layers)
 		Network.set_parents_parameters(train, train.parameters)
 		Network.set_parents_architecture(train, train.arch)