How can I select and rank the input variables in a Neural Net created with the Neural Net Pattern Recognition app?

4 views (last 30 days)
I am using the Neural Net Pattern Recognition App.
How can I select and rank the input variables in the Neural Net?
Not all input variables are significant and I want the Neural Net to remove non-significant variables.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 11 Jun 2019
One possible way to determine feature importance in a shallow network is by looking at the input weighs just before it starts over-fitting. This is shown in the next example, where the informative features are hidden within some random vectors:
rng(0)
[x,t] = cancer_dataset;
xx = ceil(rand(50,699)*10)./10;
xx([12 16 20 23 26 40 41 44 50],:) = x;
x = xx;
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize, trainFcn);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainParam.epochs = 6
% Train the Network
[net,tr] = train(net,x,t);
% ranking
[~,h]=sort(sum(abs(net.IW{1}))','descend')
For this approach to work it is important that the inputs are normalised, so the input weights can represent variable importance.
Another approach would be to use one of the variable selection approaches in the Statistics and Machine Learning Toolbox

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!