Hi, I´m trying to extract to a csv file the features names + the importance of each feature from a Random Forest Decision Tree
I code the features as:
X = df.iloc[:,2:].values
and the objective as:
y = df['Action #']
From a DataFrame that looks like the next image.
Image
By using this code I get a list with the values with no names or importances:
print(model.feature_importances_)
Have tried:
plt.barh(model.feature_names, model.feature_importances_) with error
pd.Series(model.feature_importances_, index=X.columns)
Any one may give me a hand or show me how to get this features?