XGB模型训练报错 terminate called after throwing an instance of ‘std::bad_alloc‘ what()
背景:需要做XGB模型增量训练,但是因为一些原因没有得到原来的XGB模型,只有dump文件。
XGB模型的dump文件是它的树结构存储为一个相对人类好理解的模型文件,但并不能被重新加载进XGB进行增量训练。
嗯,说是那么说,我寻思试一下,看看最新版的XGB有没有增加这个功能,只载入dump文件就可以进行XGB增量训练。
一跑起来没报错,我寻思可以呢。
一开始加载数据啥的都没问题,但是在训练的时候报错:terminate called after throwing an instance of 'std::bad_alloc' what():
,还把环境整崩了。
搜了一下,都说这是内存炸了导致的报错,但是我看了一下监控,内存完全没占满。
到这我还一直以为可能是我训练数据太大,或者是后台起的训练进程太多才导致的,完全没想过是不是dump文件的问题。
是在解决不了了,去洗了个澡,突然间就想到了,可能是dump文件的问题。
实验了一下,果然是,XGB模型增量训练只能在save_model
保存的模型文件上训练,不能在dump_model
的dump文件上训练,它不报解析错误反而报了一个内存错误。
实验代码:
import pandas as pd
import xgboost as xgb
import matplotlib.pyplot as pltfrom xgboost import plot_tree
from xgboost import XGBClassifierdata = pd.read_csv("../input/default-of-credit-card-clients-dataset/UCI_Credit_Card.csv")
X = data.iloc[:,1:6]
y = data.iloc[:,24]data = xgb.DMatrix(X, y)
xgb_params = {}
model = xgb.train(xgb_params, data)
print(model.get_dump()) model.save_model("model.pickle")
model.dump_model("model.dump")xgb_params = {'process_type':'update', 'updater':'refresh', 'refresh_leaf':True}
model_new = xgb.train(xgb_params, data, xgb_model="./model.pickle")xgb_params = {'process_type':'update', 'updater':'refresh', 'refresh_leaf':True}
model_new = xgb.train(xgb_params, data, xgb_model="./model.dump") # 报错
XGB模型训练报错 terminate called after throwing an instance of ‘std::bad_alloc‘ what()相关推荐
- c++运行时报错terminate called after throwing an instance of ‘std::bad_alloc‘
程序运行时发生错误 terminate called after throwing an instance of 'std::bad_alloc'what(): std::bad_alloc 代码类似 ...
- 报错信息 terminate called after throwing an instance of ‘std::cad_alloc‘ what():std::bad_alloc
最近做了一道bfs算法的程序题 输入测试数据后卡在运行框中 然后会产生一个错误信息 第一次见到这样的报错于是记录一下解决过程 terminate called after throwing an in ...
- terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr
运行时报错: terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::sub ...
- Linux运行python文件出现以下错误:terminate called after throwing an instance of ‘std::runtime_error‘
Linux运行python文件出现以下错误:terminate called after throwing an instance of 'std::runtime_error'
- terminate called after throwing an instance of ‘std::runtime_error‘ what(): locale::facet::_S_cre
在运行程序时出错: terminate called after throwing an instance of 'std::runtime_error' what(): locale::fac ...
- 错误:【terminate called after throwing an instance of 'std::logic_err】
自己写代码的时候,出现了一下提示 terminate called after throwing an instance of 'std::logic_error'what(): basic_stri ...
- terminate called after throwing an instance of ‘std::runtime_error‘
terminate called after throwing an instance of 'std::runtime_error' what(): random_device::random_d ...
- Centos7 编译C++项目错误解决 : terminate called after throwing an instance of ‘std::regex_error‘
文章目录 1 问题原因 1.1 确保编译器支持std::regex 2 解决方法 3 Centos7升级gcc 3.1 安装centos-release-scl 3.2 安装devtoolset 3. ...
- keras模型训练报错: AttributeError: 'list' object has no attribute 'set_model'
错误信息: AttributeError: 'list' object has no attribute 'set_model' 根据错误提示:错误代码位于如下 model.fit(X_train, ...
最新文章
- 计算机专业看能力还是学校,【计算机专业论文】学校计算机专业学生实践能力的培养(共3502字)...
- 项目ITP(二) 二维码 拿起你的手机装一装,扫一扫 【每日一搏】
- hdu4503 概率
- 【转载】PHP 常用的header头部定义汇总
- html制作背景音乐,HTML插入背景音乐方法【全】
- 用服务器控件在后台调用前台客户端JS方法
- Linux grep命令、Linux cd命令、Linux pwd命令
- DotLucene 系列文章
- 2299元 OPPO K3 8GB+256GB版本线上线下同步开售
- C#将DataTable海量数据导出到Excel
- android button text属性中英文大小写问题
- wine linux 目录,wine的安装与microsoft office在linux上的运行
- Hvv近期0day总结三
- Redis 可视化工具 Redis Desktop Manager 和 treeNMS 的使用
- idea生成class文件反编译后中文乱码
- C语言 简单走迷宫小游戏
- 自定义Dialog去除白色背景 + Dialog其他用法
- thymeleaf模板获取markdown数据后,渲染到页面上(showdown.js)
- 开题报告中的研究目的与研究内容怎么写?
- STM32中断分配——抢占优先级与响应优先级
热门文章
- 57. Insert Interval
- 08.存储Cinder→4.Cinder组件详解→3.cinder-volume
- C:如何分解整数(从末位往前取以及从首位往后取)
- 处理训练集和测试集分布同的方法(对抗训练)
- 使用Nodejs实现的小说爬虫
- spark_spark连接hive config
- Python 一路走来 Django
- Javascript知识——事件
- C++与C# 中static 成员变量的区别
- 安装oracle 12c 还用装11g_oracle12c-RAC安装部署之GRID安装