Beispiel #1
0
 def test(self, test_data, numClass):
     numSample = test_data.shape[0]
     self.flow = [test_data[:,1:]]
     for i in range(0, len(self.architecture)):
         self.flow.append(1 / ( 1 + np.exp(-np.dot(self.flow[i], self.architecture[i][0]) - np.matlib.repmat(self.architecture[i][1], numSample, 1))))
     predictMat = getPrediction(self.flow[-1])
     labelMat = oneOfK(test_data[:,0],numClass)
     #Compute presicion
     predictionAnalysis(predictMat, labelMat)
Beispiel #2
0
	def test(self, test_data, numClass):
		numSample = test_data.shape[0]
		testingData = test_data[:, 1:]
		testingLabel = test_data[:, 0:1]
		prediction = np.zeros((numSample,1))
		for i in range(0, numSample):
			prediction[i,0] = self.predict(testingData[i,:], numClass)
		predictMat = oneOfK(prediction, numClass)
		labelMat = oneOfK(testingLabel, numClass)
		predictionAnalysis(predictMat, labelMat)
Beispiel #3
0
	def test(self, test_data, numClass, showAnalysis):
		numSample = test_data.shape[0]
		testingData = test_data[:, 1:]
		testingLabel = test_data[:, 0:1]
		prediction = np.zeros((numSample,1))
		for i in range(0, numSample):
			prediction[i,0] = self.predict(testingData[i,:])		
		predictMat = oneOfK(prediction, numClass)
		labelMat = oneOfK(testingLabel, numClass)
		self.error = np.sum(np.abs(predictMat - labelMat)) / 2
		if showAnalysis == 1:
			predictionAnalysis(predictMat, labelMat)