find feature importance random forest python cod code example
Example: random forrest plotting feature importance function
def plot_feature_importances(model):
n_features = data_train.shape[1]
plt.figure(figsize=(20,20))
plt.barh(range(n_features), model.feature_importances_, align='center')
plt.yticks(np.arange(n_features), data_train.columns.values)
plt.xlabel('Feature importance')
plt.ylabel('Feature')