Answers for "random forrest plotting feature importance function"

1

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')
Posted by: Guest on May-13-2020

Code answers related to "random forrest plotting feature importance function"

Python Answers by Framework

Browse Popular Code Answers by Language