Issue
After fitting a model using SciKitLearn's Random Forest Classifier I get the feature importance list, but can I get the importance of level of a feature.
For example, if I get the series below for feature importance, how can I see which day_of_week is most important?
online_users 0.107735
number_of_post 0.051478
day_of_week 0.042552
total_votes 0.131286
polarity 0.033352
Solution
I think you can create a dummy variable for the day_of_week and then run the feature importance on the new feature set after merging the dummies and dropping day_of_week.
pd.get_dummies(df['day_of_week'])
Answered By - Amar Singh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.