Hidden layer activations with Neural Network Toolbox

Hello,
I have recently started using Matlab's Neural Network Toolbox, after some years of working with Netlab. Does anybody know how to get the activations (=output of the transfer function) of the hidden layers?
So if I create a 4-2-4 network:
net = feedforwardnet(2,'trainlm');
net = configure(net,randn(4,10),randn(4,10));
inp = randn(4,1);
out = sim(net, inp);
How can I then find the output of the hidden layer?
Regards,
Martijn

 채택된 답변

Greg Heath
Greg Heath 2016년 9월 2일

0 개 추천

The easiest way to obtain the hidden layer output of a I-H-O net is to just use the weights to create a net with no hidden layer with topology I-H.
Hope this helps.
Thank you for formally accepting my answer
Greg

추가 답변 (2개)

Martijn Onderwater
Martijn Onderwater 2011년 9월 23일

0 개 추천

Ah, got it. I calculated the activations myself, but I missed the fact that MNNT pre- and postprocesses data. See this post for a solution.
HunterE
HunterE 2016년 8월 25일

0 개 추천

You can also use genFunction to generate a .m file which should exactly reproduce the model in your net object. Then you can edit the resulting .m file to cause it to return the activations. For larger networks this is more practical than re-coding it yourself.
However, is there really no easier way to access the hidden layer activations??? If so this is a serious oversight!!

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2011년 9월 23일

답변:

2016년 9월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by