feature vector of NN

조회 수: 3 (최근 30일)
Yogini Prabhu
Yogini Prabhu 2020년 12월 31일
댓글: Yogini Prabhu 2021년 1월 10일
how to find the feature vector of NN in the attached results obtained from the nprtool (which is app for develop pattern recognition appalication of Neural network).
  댓글 수: 2
Athul Prakash
Athul Prakash 2021년 1월 8일
I'm not aware of a single function or a direct way to extract intermediate layer outputs, but I have suggested a couple of workarounds in my answer below.
Yogini Prabhu
Yogini Prabhu 2021년 1월 10일
thanks i will try those

댓글을 달려면 로그인하십시오.

채택된 답변

Athul Prakash
Athul Prakash 2021년 1월 8일
편집: Athul Prakash 2021년 1월 8일
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..
% Say 'net' is the network. Assume you want the output of layer 'i'.
net.outputConnect(i) = 1 % Modifies the architecture to set layer 'i' as an additional output.
out = sim(net, inputs) % the activations of i-th layer are now included in the output vector.
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; % Initialize 'X' as inputs. Each layer's values will be computer into 'X'.
% Layer 1
X = net.IW{1,1} * X + net.b{1}; % Compute the values of layer 1. Use 'net.IW' (input weights)
X = tansig(X) % apply whichever is the activation function of layer 1.
% Layer 2
X = net.LW{2,1} * X + net.b{2}; % compute the values of layer 2. Use 'net.LW' (layer weights)
X = logsig(X) % apply whichever is the activation function of layer 2.
% layer 3
X = net.LW{3,2} * X + net.b{3} % same of for layer 2
X = softmax(X) % apply whichever is the activation function of layer 3.
% 'X' now contains the activations of the third layer in the network.
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by