xgb_utils.py 文件源码

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

项目:Kaggle_HomeDepot 作者: ChenglongChen 项目源码 文件源码
def save_topn_features(self, fname="XGBClassifier_topn_features.txt", topn=10):
        ax = xgb.plot_importance(self.model)
        yticklabels = ax.get_yticklabels()[::-1]
        if topn == -1:
            topn = len(yticklabels)
        else:
            topn = min(topn, len(yticklabels))
        with open(fname, "w") as f:
            for i in range(topn):
                f.write("%s\n"%yticklabels[i].get_text())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号