I have created a random forest model, and would like to plot the feature importances
model_RF_tune = RandomForestClassifier(random_state=0, n_estimators = 80,
min_samples_split =10, max_depth= None, max_features = "auto",)
I have tried defining a function:
def plot_feature_importances_health(model):
n_features = model.data.shape
plt.barh(range(n_features), model.feature_importances_, align = "center")
plt.yticks(np.arrange(n_features), df_health_reconstructed.feature_names)
plt.xlabel("Feature importance")
plt.ylabel("Feature")
plt.ylim(-1, n_features)
but this plot_feature_importances_health(model_RF_tune)
Gives this result: AttributeError: 'RandomForestClassifier' object has no attribute 'data'
How do I plot it correctly?