本文整理匯總了Python中pybrain.supervised.RPropMinusTrainer.testOnClassData方法的典型用法代碼示例。如果您正苦於以下問題:Python RPropMinusTrainer.testOnClassData方法的具體用法?Python RPropMinusTrainer.testOnClassData怎麽用?Python RPropMinusTrainer.testOnClassData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pybrain.supervised.RPropMinusTrainer
的用法示例。
在下文中一共展示了RPropMinusTrainer.testOnClassData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: buildNetwork
# 需要導入模塊: from pybrain.supervised import RPropMinusTrainer [as 別名]
# 或者: from pybrain.supervised.RPropMinusTrainer import testOnClassData [as 別名]
net.addConnection(FullConnection(net["hidden2"], net["output"], name="c5"))
net.addRecurrentConnection(FullConnection(net["hidden1"], net["hidden1"], name="c6"))
net.sortModules()
# net = buildNetwork(n_input, 256, n_output, hiddenclass=LSTMLayer, outclass=TanhLayer, outputbias=False, recurrent=True)
# net = NetworkReader.readFrom('signal_weight.xml')
# train network
trainer = RPropMinusTrainer(net, dataset=training_dataset, verbose=True, weightdecay=0.01)
# trainer = BackpropTrainer(net, dataset=training_dataset, learningrate = 0.04, momentum = 0.96, weightdecay = 0.02, verbose = True)
for i in range(100):
# train the network for 1 epoch
trainer.trainEpochs(5)
# evaluate the result on the training and test data
trnresult = percentError(trainer.testOnClassData(), training_dataset['class'])
tstresult = percentError(trainer.testOnClassData(dataset=testing_dataset), testing_dataset['class'])
# print the result
print("epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult)
if tstresult <= 0.5 :
print('Bingo !!!!!!!!!!!!!!!!!!!!!!')
break
# export network
NetworkWriter.writeToFile(net, 'signal_weight.xml')
# run test
actual_price = np.array([n[3] for n in testing_input])