本文整理汇总了Python中pybrain.datasets.SequentialDataSet.getSequence方法的典型用法代码示例。如果您正苦于以下问题:Python SequentialDataSet.getSequence方法的具体用法?Python SequentialDataSet.getSequence怎么用?Python SequentialDataSet.getSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybrain.datasets.SequentialDataSet
的用法示例。
在下文中一共展示了SequentialDataSet.getSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pybrain.datasets import SequentialDataSet [as 别名]
# 或者: from pybrain.datasets.SequentialDataSet import getSequence [as 别名]
hypereval.append(min(eval_err))
hypermin = hypereval.index(min(eval_err))
net = hypernet[hypermin]
print("number of hidden layers", hypermin+1)
#Testing data
ds = SequentialDataSet(1, 1)
dat = data[tedatf:tedats]
# The next_sample picks a next number of the begin of the sample
for sample, next_sample in zip(dat, cycle(dat[1:])):
ds.addSample(sample, next_sample)
print("put into practice:", ModuleValidator.validate(Validator.MSE, net, dataset=ds))
pred = []
for sample, target in ds.getSequenceIterator(0):
pred.append(net.activate(sample))
b = ds.getSequence(0)
ax1 = plt.subplot(1,1,1)
ax1.plot(b[1], label='tar')
ax1.plot(pred, label='pre')
ax1.legend(loc=1, ncol=2, shadow=True)
plt.title('Stock Predicting Result')
plt.xlabel('Time')
plt.ylabel('Return of The Stock')
plt.show()