RFfastestLap.py 文件源码

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

项目:f1_2017 作者: aflaisler 项目源码 文件源码
def plot_importance(names, model, savefig=True):
    featureNames = numpy.array(names)
    featureImportance = model.feature_importances_
    featureImportance = featureImportance / featureImportance.max()
    sorted_idx = numpy.argsort(featureImportance)
    barPos = numpy.arange(sorted_idx.shape[0]) + .5
    plot.barh(barPos, featureImportance[sorted_idx], align='center')
    plot.yticks(barPos, featureNames[sorted_idx])
    plot.xlabel('Variable Importance')
    plot.subplots_adjust(left=0.2, right=0.9, top=0.9, bottom=0.1)
    if savefig:
        dt_ = datetime.datetime.now().strftime('%d%b%y_%H%M')
        plt.savefig("../graphs/featureImportance_" + dt_ + ".png")
    plot.show()


# Plot prediction save the graph with a timestamp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号