If I trained a network using Neural Network classifier, how can I know which feature was most important for predicting the target variable? I mean how to create a "feature ranking" among the features (from high importance value to low). I have seen some literature about decision trees/AdaBoost but I am typically interested in Neural networks especially for classification purpose. To make it more clear, an example is shown in the figure.



The firs solution sevo proposes is not feasible because of a third problem that was not mentioned. The first layer only learns a first representation of the input, which is used in later layers. Even if the absolute weights of $x_1$ might be very big, if the later layers have small weights connected to these neurons the importance goes down. This is exactly why neural networks are considered to be difficult to interpret. The rest of the answer is useful, I just wanted to add this.


There are multiple possibilities.

The obvious one is to sum weights of all connections from input layer to the first hidden layer per input neuron. The neuron with highest sum of connection weights should be the most important. This has several problems.

  • Weights could be negative so you should use absolute value of them.
  • The weight depend on the scale of the input variable. You should normalize the input for example by subtracting mean and dividing by standard deviation of the input (z-normalization).

Another possibility is to selectively remove features, retrain the network and observe removal of which features caused the biggest decrease in model accuracy. These are potentially the most important features.

The problem of this approach is, that it changes the architecture of the network, retrains it and does not report the relevance of features entering the original network.

You can find an elaborate discussion on the problem here ftp://ftp.sas.com/pub/neural/importance.html

There are multiple other approaches, such as Garson's, using complex functions to correct for some problems. You can find several of them implemented in NeuralNetTools package in R.

  • $\begingroup$ is this is ok for second bullet you have propsed.(mathworks.com/help/stats/zscore.html ) ? $\endgroup$ – Case Msee Sep 19 '17 at 1:52
  • $\begingroup$ Yes, this should normalize all columns of the input dataset. $\endgroup$ – sevo Sep 19 '17 at 7:42
  • $\begingroup$ But,this Z-score will normalizes the value to [0,1] right?not in range of [-1,1] $\endgroup$ – Case Msee Sep 20 '17 at 5:17
  • $\begingroup$ Neither. It will normalize the column to have mean equal to 0 and standard deviation equal to 1. Values will not be restricted to any firm interval. $\endgroup$ – sevo Sep 20 '17 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.