I have constructed an LSTM network to do regression of a sequence data. When I try to get the activation of the hidden layer (which is the LSTM layer) it returns zero. The network only has one hidden layer, one input and one output layer.
I try to get the hidden layer value with the following snippet.
print net.activate(data)
print net['in'].outputbuffer[net['in'].offset]
print net['hidden0'].outputbuffer[net['hidden0'].offset]
Any idea why? Below is a more complete code snippet
RopewayIn = RopewayOverallData[:-1, :]
RopewayOut = RopewayOverallData[1:, :]
ds.newSequence()
for i in range(noDataFrames):
ds.appendLinked( [RopewayIn[i,0],RopewayIn[i,1], RopewayIn[i,2], RopewayIn[i,3], RopewayIn[i,4], RopewayIn[i,5], RopewayIn[i,6], RopewayIn[i,7], RopewayIn[i,8], RopewayIn[i,9]],
[RopewayOut[i,0],RopewayOut[i,1], RopewayOut[i,2], RopewayOut[i,3], RopewayOut[i,4], RopewayOut[i,5], RopewayOut[i,6], RopewayOut[i,7], RopewayOut[i,8], RopewayOut[i,9]] )
net = buildNetwork(10,20,10, hiddenclass=LSTMLayer,outclass=LinearLayer, bias=True, recurrent=True)
trainer = RPropMinusTrainer(net, dataset=ds, verbose=True, weightdecay=0.01)
for i in range(10001):
trainer.trainEpochs(2)
print net.activate(RopewayOverallData[0,4])
print net['in'].outputbuffer[net['in'].offset]
print net['hidden0'].outputbuffer[net['hidden0'].offset