how does random forest feature importance work code example
Example 1: sklearn random forest feature importance
import pandas as pd
forest_importances = pd.Series(importances, index=feature_names)
fig, ax = plt.subplots()
forest_importances.plot.bar(yerr=std, ax=ax)
ax.set_title("Feature importances using MDI")
ax.set_ylabel("Mean decrease in impurity")
fig.tight_layout()
Example 2: sklearn random forest feature importance
RandomForestClassifier(random_state=0)