Exemple #1
0
	def trainError(self):
		"""Compute RMS error of the training set"""

		trainFilepath = "{}{}".format(self.exp['directory'], self.exp['train_file'])

		ret = util.readTrials(trainFilepath)

		return self.rnn.error(inputs=ret['inputs'], targets=ret['targets'])
Exemple #2
0
	def testError(self):
		"""Compute RMS error of the testing set"""

		testFilepath = "{}{}".format(self.exp['directory'], "Unused_Locs.train")

		ret = util.readTrials(testFilepath)

		return self.rnn.error(inputs=ret['inputs'], targets=ret['targets'])
Exemple #3
0
	def train(self, loadW=False):
		if loadW is True:
			if self.exp['W'] is None:
				loadW = "{}W".format(self.exp['directory'])
			else:
				loadW = "{}{}".format(self.exp['directory'], self.exp['W'])

		if self.exp['directory'] == None or self.exp['directory'] == '':
			trainFilepath = self.exp['train_file']
		else:
			trainFilepath = "{}{}".format(self.exp['directory'], self.exp['train_file'])

		ret = util.readTrials(trainFilepath)

		inputs = ret['inputs']
		targets = ret['targets']
		inputNames = ret["inputNames"]
		targetNames = ret["targetNames"]

		if not loadW:
			isSuccess = train_saccade(self.num_trains, inputNames, targetNames,
									  inputs, targets, self.rnn)
			self.num_trains += 1
			if isSuccess != True:
				print "Error: Overfitting in batch run"
				return False
			print "Training Successful \(0_0)/"
			# Indicate that we finished at least one training cycle and may now load old weights
			self.trained = True
		else:
			print "Loading weights from previous training"
			print "\n\n\n(0_0)\n\n\n"
			isSuccess = train_saccade(self.num_trains, inputNames, targetNames,
									  inputs, targets, self.rnn, load_weights=loadW)
			self.num_trains += 1
			if isSuccess != True:
				print "Error: Overfitting in batch run"
				return False
			print "Training Successful \(0_0)/"

		return True
Exemple #4
0
	def getTestInputs(self):
		return util.readTrials(self.exp['directory'] + "Unused_Locs.train")
Exemple #5
0
	def getTrainInputs(self):
		return util.readTrials(self.exp['directory'] + self.exp['train_file'])