How to obtain the relative importance of each input variable for a neural network?
Afficher commentaires plus anciens
Hi. I have build a regression neural network with 580 data points of 48 inputs and 5 outputs. The optimum network is 30 neurons for the first hidden layer and 17 neurons for the second hidden layer as shown in the figure below. I would like to know is there any methods to understand the relationship between inputs and outputs for the neural network (whether they have positive or negative significant relationship)? How to obtain the relative importance of each input to each output? Thanks.

Réponse acceptée
Plus de réponses (3)
Yago Veloso
le 18 Jan 2017
Modifié(e) : Yago Veloso
le 18 Jan 2017
1 vote

You can use the relative importance method using the equation above, where Rij is the relative importance of the variable xi with respect to the output neuron j, H is the nunber of neurons in the hidden layer, Wik is the synaptic connection weight between the input neuron i and the hidden neuron k, and Wkj is the synaptic weight between the hidden neuron k and the output neuron j.
If it's not very clear for you take a look at this paper here: http://www.palisade.com/downloads/pdf/academic/DTSpaper110915.pdf
Good look! Regards Yago
1 commentaire
tanfeng
le 30 Mai 2019
0 votes
Same question!
Iman Jafari
le 8 Sep 2021
Modifié(e) : Iman Jafari
le 11 Sep 2021
The relative importance of input variables on selected outputs can be estimated using following equation and code. Where Ej, W and N are the relative importance of the jth input variable on, weighted coefficient, and the number of neurons, respectively. The subscripts ‘k’, ‘t’ and ‘n’ refer to input, hidden and output neurons, respectively and the superscripts ‘i’, ‘h’ and ‘o’ refer to input, hidden and output layers, respectively.

W1= net.IW{1,1}; % Weights between input and hidden layers
W2= net.LW{2,1}'; % Weights between hidden and output layers
k= size(W1,2); % number of input varables
g=1; % Select which output you are going to evaluate the relative importance of
% input variables on (No need to change if you have only one output)
for n=1:k
for i=1:k
a(:,i)=(abs(W1(:,n))./sum(abs(W1(:,1:i)),2)).*abs(W2(:,g));
end
b=sum(sum(a,2));
I(n,1)=sum(abs(W1(:,n))./sum(abs(W1),2))/b;
end
for i=1:k
R(i,1)=(I(i)/sum(I))*100; % Percentage
end
6 commentaires
Reza Mazloum
le 5 Oct 2021
Hi Iman, Tnx for this script. Just have a question. I used it for different dataset and don't understand why the first predictors for all outputs (classes) have the biggest value?
Cheers,
Reza
Iman Jafari
le 28 Déc 2021
Hi Reza,
It's due to the configuration of your model and the nature of your data set. In your case the first predictor has always the most importance on predicting your outputs (classes).
Regards, Iman
Jorge Pesantez Sarmiento
le 9 Juin 2022
Hi Iman,
Thank you for posting that equation. May I ask for a reference for this work?
Diana El assal
le 20 Mar 2023
Hi Iman,
Do you have a reference for this equation, please?
moha z
le 28 Sep 2023
Hi,
Please introduce its source, thank you.
Jorge
le 21 Mar 2024
Hey,
I'm trying to implement this equation. However, when I retrieve the weights of the input variables with net.IW{1,1}, MATLAB fitnet drops two input variables and I cannot identify which ones. I thought it was removing input varialbes with NaN values, but it is not the case. There are seven input varaibes with some instances of NaN values, but MATLAB keeps removing two variables only. Any idea on how to find which variables are being removed without testing one at a time?
Thank you.
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!