本文整理汇总了Python中pybrain.supervised.RPropMinusTrainer.setData方法的典型用法代码示例。如果您正苦于以下问题:Python RPropMinusTrainer.setData方法的具体用法?Python RPropMinusTrainer.setData怎么用?Python RPropMinusTrainer.setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.supervised.RPropMinusTrainer
的用法示例。
在下文中一共展示了RPropMinusTrainer.setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sum
# 需要导入模块: from pybrain.supervised import RPropMinusTrainer [as 别名]
# 或者: from pybrain.supervised.RPropMinusTrainer import setData [as 别名]
# import random
# random.shuffle(sequences)
# concat_sequences = []
# for sequence in sequences:
# concat_sequences += sequence
# concat_sequences.append(random.randrange(100, 1000000))
# # concat_sequences = sum(sequences, [])
# for j in xrange(len(concat_sequences) - 1):
# ds.addSample(num2vec(concat_sequences[j], nDim), num2vec(concat_sequences[j+1], nDim))
# trainer.train()
net = initializeLSTMnet(nDim, nLSTMcells=50)
net.reset()
ds = SequentialDataSet(nDim, nDim)
trainer = RPropMinusTrainer(net)
trainer.setData(ds)
for _ in xrange(1000):
# Batch training mode
# print "generate a dataset of sequences"
import random
random.shuffle(sequences)
concat_sequences = []
for sequence in sequences:
concat_sequences += sequence
concat_sequences.append(random.randrange(100, 1000000))
for j in xrange(len(concat_sequences) - 1):
ds.addSample(num2vec(concat_sequences[j], nDim), num2vec(concat_sequences[j+1], nDim))
trainer.trainEpochs(rptNum)
print