I've been modeling metabolite data with 3 different regressor models. I get similar results from running feature importance with Random Forest model and Gradient Boosted Decision Trees (where I used the scikit-learn built-in feature importance), but with Deep Neural Networks I get very different results (used permutation feature importance). I also ran PCA, and PCA gave me similar results to DNN! Is this normal? Could both of them be accurate still? I have quite a large amount of initial features.
Few factors that can cause such differences -
A common issue with the default RF FE approach.
It's not reliable in situations where potential predictor variables vary in their scale of measurement or their number of categories
When you have correlated features,
RF Tree-based FI approach will divide the importance depending upon how the Tree used the two correlated Features
Permutation based method will assign negligible importance to both as skipping anyone will have no impact on the result
If we have two Features with Interaction,
Tree based approach will catch the Interaction in successive splits and accordingly divide the importance into two Features
Permutation based method will assign high importance to both the Features as dip will be high when anyone is skipped(Assuming additive Interaction)
In this case, this is a question to ponder how the FI should be divided when two Features are interacting. Ideally, a third feature(e.g. X1*X2) should be created and should get all the FI.
You should try -
- Identity correlated Features using respective tests e.g.Pearson, Crammers, Spearman etc.
- Use Permutation approach for all cases. Sklearn has got the option
#https://scikit-learn.org/stable/modules/permutation_importance.html from sklearn.inspection import permutation_importance r = permutation_importance(model, X_val, y_val, n_repeats=30)
- Then if needed, look for any interaction effect (See suggested reading)
Why would you expect them to be the same?
In one hand Random Forest and Gradient boosting are two types of different ensembles. Even if their estimator is a decision tree and they both seem to measure in scikit learn impurity-based feature importance. The result will be different. Not much is my guess, but different.
For Deep Neural Networks, you are calculating a different "feature importance" metric. So it makes sense that the calculated result is different.
Sadly, feature importance is just aggregation statistics that does not tell you much about the explainability of the model.
Different feature importance in different models is completely fine, no problem with that.