Thief of Wealth

def plot_feature_importance(model, X_train, figsize=(12, 6)):

    sns.set_style('darkgrid')

    

    # Plot feature importance

    feature_importance = model.feature_importances_

    feature_importance = 100.0 * (feature_importance / feature_importance.max())

    sorted_idx = np.argsort(feature_importance)

    pos = np.arange(sorted_idx.shape[0]) + .5


    plt.figure(figsize=figsize)

    plt.barh(pos, feature_importance[sorted_idx], align='center')

    plt.yticks(pos, X_train.columns[sorted_idx])

    plt.xlabel('Relative Importance')

    plt.title('Variable Importance')

    plt.show()

'개발 > ML+ Data Science' 카테고리의 다른 글

KDD 방법론이란?  (0) 2020.01.05
CNN 층별 파라미터 구하기  (0) 2019.11.30
Pandas DataFrame에 dict적용하기  (0) 2019.11.10
KFold에서 1개의 set의 score만 낮게 나온다면?  (0) 2019.11.08
KFold Example  (0) 2019.11.06
profile on loading

Loading...