I have a neural network to solve a time series forecasting problem. It is a sequence-to-sequence neural network and currently it is trained on samples each with ten features. The performance of the model is average and I would like to investigate whether adding or removing features will improve the performance. I have constructed the neural network using keras.

The features I have included are:

  1. The historical data
  2. quarterly lagged series of the historical data (4 series)
  3. A series of the change in value each week
  4. Four time invariant features tiled to extend the length of the series. (another 4 series)

I am aware I could run the model many times changing the combination of features included each time. However, along with tuning the hyperparameters (for it might be that 8 features works really well with one set of hyperparameters but not with another set) this is really a lot of possible combinations.

Is there any separate way that I can use to guage if a feature is likely to add value to the model or not?

I am particuarly concerned that I have four time-invariant features being fed into the model which is designed to work with time varying data and I would like a way to measure their impact and if they add anything or not?

  • 1
    $\begingroup$ You basically want to assess the statistical significance of your features. There's no native inexpensive way to do with with a neural network. However, you could do this by fitting a separate regression with ARMA errors model and check coefficient p-values. $\endgroup$
    – Digio
    Jan 27, 2019 at 14:20
  • $\begingroup$ What you suggest sounds interesting, but could you expand upon your idea a little bit, I didn't fully understand. $\endgroup$
    – Aesir
    Jan 27, 2019 at 14:27
  • 2
    $\begingroup$ You could try fitting a type of linear model to your series, using your neural network features as the dependent variables, then look at coefficient p-values to see which features have important impact to the series. There are many ways to do this, R has regression with ARMA errors (package forecast), python has the GLSAR class, and with some extra manual work you can do this using simple linear regression. $\endgroup$
    – Digio
    Jan 27, 2019 at 15:26

3 Answers 3


Don't remove a feature to find out its importance, but instead randomize or shuffle it.

Run the training 10 times, randomize a different feature column each time and then compare the performance. There is no need to tune hyper-parameters when done this way.

Here's the theory behind my suggestion: feature importance

  • $\begingroup$ Do you mean by "randomize" setting the values of this feature to random numbers (between 0 and 1, depending on the scaling)? $\endgroup$
    – NeStack
    Feb 3, 2021 at 16:33
  • $\begingroup$ Can I apply the trained model to each variable shuffled (one at a time), or do I need to retrain the model each time I make a shuffle? $\endgroup$
    – Stu
    Nov 23, 2021 at 22:45

Linking to the same paper as @scholle but explaining the process differently (book and paper).

  1. You do not need to train the model multiple times. The algorithm described in the links above require a trained model to begin with.
  2. Given a trained model, compute the metric of interest on some dataset (the book discusses pros/cons of using training set vs test set).
  3. For each feature in your same dataset, shuffle the values of the feature in question. All other features and labels should remain unchanged for each observation.
  4. Perform inference on the model with this shuffled dataset (one shuffled feature at a time), and compute the desired metric for each pass.
  5. Now compute the difference between the original metric (unchanged dataset) and the metric obtained for each feature pass (the book also mentions dividing the permuted score / original score).

Voila! The list of feature importance is the sorted output of step 5 (in descending order - higher value means the feature is more important to the model in question).

Edit - should I use training set or test/dev set to do permutation feature importance?

The book linked above addresses this question. A more concise answer can be found on SKLearn's docs:

Permutation importances can be computed either on the training set or on a held-out testing or validation set. Using a held-out set makes it possible to highlight which features contribute the most to the generalization power of the inspected model. Features that are important on the training set but not on the held-out set might cause the model to overfit.


You can do this sort of thing using SHAP, it looks at permutation importance as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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