You can extract the network and inputs from the 'results' struct using..
net = results.net
inputs = results.inputs
I found 2 ways to extract activations from intermediate layers in a 'network' object :-
Approach 1
You may modify the architecture to specify the required layer as an outputLayer..
net.outputConnect(i) = 1
out = sim(net, inputs)
Approach 2
Manually run the neural network by executing it's underlying maths.
Suppose you're trying to get the outputs of layer 3...
X = inputs;
X = net.IW{1,1} * X + net.b{1};
X = tansig(X)
X = net.LW{2,1} * X + net.b{2};
X = logsig(X)
X = net.LW{3,2} * X + net.b{3}
X = softmax(X)
The manual computation might require tinkering with the 'network' object's many properties. You may follow the attached documentation to get a better understanding of these properties and how to manipulate them.
Hope it Helps!
2 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/706123-feature-vector-of-nn#comment_1251773
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/706123-feature-vector-of-nn#comment_1251773
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/706123-feature-vector-of-nn#comment_1254568
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/706123-feature-vector-of-nn#comment_1254568
Sign in to comment.