本文整理匯總了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