housing.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:Python-Machine-Learning-Cookbook 作者: PacktPublishing 项目源码 文件源码
def plot_feature_importances(feature_importances, title, feature_names):
    # Normalize the importance values 
    feature_importances = 100.0 * (feature_importances / max(feature_importances))

    # Sort the values and flip them
    index_sorted = np.flipud(np.argsort(feature_importances))

    # Arrange the X ticks
    pos = np.arange(index_sorted.shape[0]) + 0.5

    # Plot the bar graph
    plt.figure()
    plt.bar(pos, feature_importances[index_sorted], align='center')
    plt.xticks(pos, feature_names[index_sorted])
    plt.ylabel('Relative Importance')
    plt.title(title)
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号