I was working on a small classification problem (breast cancer data set from sklearn), and trying to decide which features were most important to predict the labels. I understand that there are several ways to define "important feature" here (permutation importance, importance in trees ...), but I did the following: 1) rank the features by coefficient value in a logistic regression ; 2) rank the features by "feature importance" from a random forest. These don't quite tell the same story, and I'm thinking that a feature that might be "unimportant" in a linear model could be very discriminative in a non-linear model that can "understand" it.

Is that true in general? Or should "important" features (those that contribute most to a classification score) be the same across all types of models?

  • 3
    $\begingroup$ You are at the edge of a very important idea: interaction. One-at-a-time testing completely ignores and excludes this. It is a critical part of statistical design of experiments (DoE). In DoE you will see that the presumed model very strongly drives how you treat the variables, and that a weaker model can easily miss significant higher order interactions. Even the mighty random forest is imperfect in its measure of importance, though it accounts for nonlinearity and interactions. There are no silver bullets, but you will find there are different calibers. $\endgroup$ Aug 24 '20 at 18:05

When it comes to feature importance I always go with a model-agnostic measure, as you well mention if you have two different models, they will interpret importance in different terms (Linear models as the coefficient and Tree-based models as the information gain/impurity decrease on each feature.

So you already mention one measure that does not depends on the model, rather on the metric you are interested in; Permutation importance does not care about what model you are using, but the impact that a feature has on the global performance.

This reference might give you a better idea of the advantages of using permutation importance over tree-based models importance Permutation Importance vs Random Forest Feature Importance

  • 2
    $\begingroup$ Hmm, yes, but - in the end, you will implement a definite model to e.g. detect cancer - why not look at feature importance under that model, rather than a model agnostic feature importance that might actually not give you the best insights for the model you implement? $\endgroup$
    – Frank
    Aug 25 '20 at 0:38
  • 2
    $\begingroup$ I think those are separate task, with model agnostic you are making feature selection whereas If you want to get the best insights for the model you implement you are talking about model explainability (suitable tools for such task are among others SHAP values, partial dependence plots). If still, you want to use the coefficients of the model for feature selection you will encounter what you already have, different models might tell different conclusions, but at the end is up to you $\endgroup$ Aug 25 '20 at 19:48

Your intuition so far is correct. Feature importance does not extend across models. The feature score for an xgboost model might be irrelevant and a wrong assumption for trsining another model. There is no perfect way to define important features. It does require some prior knowledge about the data in general.


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.