在看了this answer之后,我在导出我的网络时遇到了一些困难。以下是网络生成代码:
net = buildNetwork(2, 1, 1, bias=False)
sol = net.activate([2,3])
print("solution", sol)
for mod in net.modules:
for conn in net.connections[mod]:
print("connection:",conn)
for cc in range(len(conn.params)):
print(conn.whichBuffers(cc), conn.params[cc])产出:
solution [ 0.12654066]
connection: <FullConnection 'FullConnection-3': 'hidden0' -> 'out'>
(0, 0) 1.02869832075
connection: <FullConnection 'FullConnection-4': 'in' -> 'hidden0'>
(0, 0) 0.410307885215
(1, 0) -0.928280457049它提出的解决方案难道不等于
(0.410307885215*2-0.928280457049*3)*1.02869832075是-2.0206而不是0.12654066
发布于 2015-09-05 15:48:13
好吧,所以我忘了一个激活函数。默认的激活函数是sigmoid函数,在python中可以很容易地使用该函数。
from scipy.special import expit
expit((0.410307885215*2-0.928280457049*3))*1.02869832075 = 0.1265406616438563我的下一个问题是如何增加偏见。在运行sigmoid函数之前会添加偏差。所以如果你在做:
net = buildNetwork(2, 1, 1, bias=True)然后,它从本质上构建:
expit(weight_in1*input1+weight_in2*input2+hidden_bias)*hidden_weight+bias_out希望这对那些和我有同样问题的人来说是有意义的。
https://stackoverflow.com/questions/32410295
复制相似问题