MATLAB Answers

How to compute sensitivity analysis in neural network model?

34 views (last 30 days)
How to compute sensitivity analysis in neural network model? I would like to find the level of importance of each input.
Input value is 12x1505 double. Target value is 1x1505 double.
Here is my code:
x = Input';
t = Target';
trainFcn = 'trainlm';
hiddenLayerSize = 3;
net = feedforwardnet(hiddenLayerSize,trainFcn);
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'divideind';
net.divideParam.trainInd = 1:903;
net.divideParam.valInd = 904:1204;
net.divideParam.testInd = 1205:1505.
net.performFcn = 'mse';
[net,tr] = train(net,x,t);
y = net(x);
e = gsubtract(t,y);
performance = mse(net,t,y)
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)
view(net)
Thank you very much
Janthorn
  1 Comment
Greg Heath
Greg Heath on 28 Mar 2015
It is confusing when you make assignments that are already defaults
trainFcn = 'trainlm';
net = feedforwardnet(hiddenLayerSize,trainFcn) ;
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};
net.performFcn = 'mse';

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 27 Mar 2015
1. Use MAPSTD or ZSCORE to standardize the data BEFORE training.
2. Design 10 or more successful nets with the smallest number of hidden nodes as possible.
3. For each input: Add Gaussian noise to only that input. Tabulate and plot MSE vs noise standard deviation
There are also many, many, approaches for ranking inputs via backward and forward searches. In backward search, replacing an input with zeros (it's mean value) is equivalent to removing it.
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (1)

Community Treasure Hunt

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

Start Hunting!