Get feature importance from GridSearchCV

Got it. It goes something like this :

optimized_GBM.best_estimator_.feature_importance()

if you happen ran this through a Pipeline and receive object has no attribute 'feature_importance' try optimized_GBM.best_estimator_.named_steps["step_name"].feature_importances_

where step_name is the corresponding name in your pipeline


This one works

optimized_GBM.best_estimator_.feature_importances_

That depends on what model you have selected. If you choose a SVM you wont be having feature importance parameter, but in decision trees you will get it