Example #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)
Example #2
0
 def predict(self, data, numClass):
     self.flow = [data[:,1:]]
     for i in range(0, len(self.architecture)):
         self.flow.append(1 / ( 1 + np.exp(-np.dot(self.flow[-1], self.architecture[i][0]) - np.matlib.repmat(self.architecture[i][1], numSample, 1))))
     return getPrediction(self.flow[-1])