本文整理汇总了Python中pybrain.supervised.trainers.BackpropTrainer.ds方法的典型用法代码示例。如果您正苦于以下问题:Python BackpropTrainer.ds方法的具体用法?Python BackpropTrainer.ds怎么用?Python BackpropTrainer.ds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.supervised.trainers.BackpropTrainer
的用法示例。
在下文中一共展示了BackpropTrainer.ds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDataset
# 需要导入模块: from pybrain.supervised.trainers import BackpropTrainer [as 别名]
# 或者: from pybrain.supervised.trainers.BackpropTrainer import ds [as 别名]
ds._convertToOneOfMany()
return ds
trainingData = createDataset(X_train, Y_train)
validationData = createDataset(X_valid, Y_valid)
testData = createDataset(X_test, Y_test)
trainer = BackpropTrainer(net, trainingData) #, verbose=True)
#trainer.trainUntilConvergence(verbose=True, trainingData=trainingData, validationData=validationData)
maxEpochs = 100
continueEpochs = 10
convergence_threshold = 10
trainingErrors = []
validationErrors = []
trainer.ds = trainingData
bestweights = trainer.module.params.copy()
bestverr = trainer.testOnData(validationData)
bestepoch = 0
trainingErrors = []
validationErrors = [bestverr]
print('> Training')
epochs = 0
while True:
trainingError = trainer.train()
validationError = trainer.testOnData(validationData)
print('Validation error = %f - Training error = %f' % (validationError, trainingError))