使用下面的代码:
tf = open('defl_07h.csv','r')
for line in tf.readlines():
data = [float(x) for x in line.strip().split(';') if x != '']
indata = tuple(data[:1])
outdata = tuple(data[1:])
ds.addSample(indata,outdata)
net = buildNetwork(ds.indim,20,ds.outdim,recurrent=True)
t = BackpropTrainer(net,learningrate=0.01,momentum=0.5,verbose=True)
t.trainOnDataset(ds,10)
t.testOnData(verbose=True)
得到相同的输出如下:
出:[3.479] 正确:[11.86] 错误:35.12389858 出:[3.479] 正确:[12.1] 错误:37.16423359 出:[3.479] 正确:[12.28] 错误:38.73228485
然后创建了网络结构:
Module: in
-connection to hidden0
- parameters [-1.9647867 -0.41898579 -0.24047698 0.6445537 0.06084947 -3.17343892
0.25454776 -0.45578641 0.70865416 -0.40517853 -0.22026247 -0.13106284
-0.71012557 -0.61140289 -0.00752148 -0.61770292 -0.50631486 0.95803659
-1.07403163 -0.87359713]
Recurrent connections
Module: bias
-connection to out
- parameters [ 0.55130311]
-connection to hidden0
- parameters [-0.31297409 -0.2182261 -0.70730661 -1.65964456 -0.18366456 0.52280203
-0.03388935 0.61288256 2.49908814 0.53909862 -0.56139066 0.06752532
-0.71713239 -1.4951833 0.84217369 0.16025118 0.01176442 -0.59444178
0.85652564 1.60607469]
Recurrent connections
Module: hidden0
-connection to out
- parameters [ 1.00559033 -0.02308752 -2.51970163 0.39714524 0.33257302 -0.6626978
-0.53004298 -1.0141971 -0.95530079 -0.66953093 -0.00438377 -1.1945728
0.99363152 -1.17032002 0.03620047 -0.21081934 0.2550164 -1.65894533
0.20820361 -1.38895542]
Recurrent connections
Module: out
Recurrent connections
错误可能在哪里?