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).
Prashant Kumar answered .
2025-11-20
net = results.net inputs = results.inputs
% 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.
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.