Xgboost Classifier feature importance(Python)


#1

HI All,

I am trying to figure out how to get the original feature names when I print the features and score from the model.Currently, I am getting all the feature names as f0,f1,f2 etc and its corresponding score, but how do I derive the original feature names from it ?
I used feature hashing instead of onehot encoding because in the future my test set may not contain all the categorical values for a few columns and this could potentially to an error if I use onehot encoding. The feature hashing converts the data into a sparse matrix and I am losing my feature names.
Kindly help as I have been stuck on this for last couple of days.
Thank you!