使用vs2013 debug xgboost C++码源

来源:互联网 发布:多益网络手游新游戏 编辑:程序博客网 时间:2024/06/10 21:16

使用vs2013 debug xgboost C++码源

引言

xgboost有python,R接口可以方便的使用,其利用libxgboost.dll调用由C++编写的核心类,但是无法debug程序的每一条语句,因此有必要运行一下C++版本xgboost。下面是简要步骤。
1.从https://github.com/dmlc/xgboost下载xgboost码源
2.使用vs2013编译xgboost.sln文件,具体方法参考https://xgboost.readthedocs.io/en/latest/build.html中Building on Windows 中使用vs编译的部分。
3.打开xgboost.sln工程,接下来部分介绍如何运行cli_main.cc文件
3.1 找到码源的xgboost\demo\binary_classification目录
cmd下运行下面命令生成数据
python mapfeat.py
python mknfold.py agaricus.txt 1
其中mushroom.conf是要作为cli_main.cc的主函数参数传入的(其中数据路径的参数改成绝对路径不加引号)
3.2打开vs2013工程右键xgboost项目->属性->配置属性->调试->命令行参数:mushroom.conf的绝对路径
3.3程序中打断点,debug运行xgboost项目(注意只运行xgboost,不要debug solution中的其他项目),至此就可以单步运行C++码源了!!

1 0
原创粉丝点击