本文整理匯總了Python中NN.neuralNet方法的典型用法代碼示例。如果您正苦於以下問題:Python NN.neuralNet方法的具體用法?Python NN.neuralNet怎麽用?Python NN.neuralNet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NN
的用法示例。
在下文中一共展示了NN.neuralNet方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: open
# 需要導入模塊: import NN [as 別名]
# 或者: from NN import neuralNet [as 別名]
trainingdatafile = open('newdata.txt', 'r')
inputdata= readRecords(trainingdatafile)
datasize = len(inputdata)
# Randomly splits the file in 80-20 split for test and train data
trainingbatch , testbatch = train_test_split(inputdata, test_size=0.2)
# Values for the no of hidden, input and output neurons
numHiddenCells = 64
numInputCells = 9
numOutputCells = len(inputdata[0]) - numInputCells
nn = NN.neuralNet(numInputCells, numHiddenCells, numOutputCells)
errTrain = nn.train(trainingbatch)
errPred = 0
for test in testbatch:
output = nn.predict(test[:numInputCells])
#print output, np.argmax(test[numInputCells:]) + 1
if (output != np.argmax(test[numInputCells:]) + 1) :
errPred = errPred + 1
print errTrain, len(trainingbatch)
print errPred, len(testbatch)