Window下XGBoost安装
来源:互联网 发布:mac os x 10.10 iso 编辑:程序博客网 时间:2024/05/16 18:14
本文主要是对XGBoost安装进行介绍。
在正文开始前,需要安装一些前置软件如下:
- Git - MINGW
下面开始正文介绍。
1.首先创建XGBoost安装目录文件,然后在该目录下面启动git bash.
E:\Xgboost
2.然后执行如下命令。
$ git clone --recursive https://github.com/dmlc/xgboost$ cd xgboost$ git submodule init$ git submodule update
3.下载MinGW-W64,然后安装。
4.这里需要修改Architecture值为x86_64,因为我的本机是64位操作系统。
5.这里安装在我们前面创建的文件目录下面。
6.然后将mingw64\bin配置到path中,然后重启bash,检验是否安装成功.
$ which mingw32-make/e/Xgboost/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev1/mingw64/bin/mingw32-make
7.取别名
$ alias make='mingw32-make'
8.逐个编译各个模块
$ cd xgboost/$ pwd/e/Xgboost/xgboost$ cd dmlc-core$ make -j4$ cd ../rabit$ make lib/librabit_empty.a -j4$ cd ..$ cp make/mingw64.mk config.mk$ make -j4
9.然后打开xgboost的python-package
$ cd python-package/$ pwd/e/Xgboost/xgboost/python-package
10.安装
/e/Xgboost/xgboost/python-package/python setup.py install
11.打开cmd,启动python,然后在命令行中加入如下内容。
import osmingw_path = 'E:\\Xgboost\\mingw-w64\\x86_64-7.1.0-posix-seh-rt_v5-rev1\\mingw64\\bin'os.environ['PATH'] = mingw_path + ';' + os.environ['PATH']
12.验证是否安装成功.
>>> import xgboost as xgb>>> dtrain = xgb.DMatrix('E:/data/agaricus.txt.train')[19:30:53] 490x127 matrix with 10780 entries loaded from E:/data/agaricus.txt.train>>> dtest = xgb.DMatrix('E:/data/agaricus.txt.test')[19:31:19] 177x127 matrix with 3894 entries loaded from E:/data/agaricus.txt.test>>> param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' }>>> num_round = 2>>> bst = xgb.train(param, dtrain, num_round)>>> # make prediction... preds = bst.predict(dtest)>>>>>> predsarray([ 0.0432693, 0.9445464, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.9445464, 0.0432693, 0.9445464, 0.0432693, 0.9445464, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.9445464, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.0432693, 0.9445464, 0.0432693, 0.0432693, 0.0432693, 0.0432693, .........
参考文献:
https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=zh
https://xgboost.readthedocs.io/en/latest/build.html
https://xgboost.readthedocs.io/en/latest/get_started/
https://github.com/dmlc/xgboost/tree/master/demo/data
阅读全文
5 0
- window下安装xgboost
- Window下XGBoost安装
- window下python-xgboost的安装
- WIndow的Anaconda下安装Xgboost
- window+anaconda3+python3.5下xgboost安装
- 在Window平台下安装xgboost的Python版本
- window下安装xgboost包(三步)
- Linux下安装xgBoost
- linux 下安装xgboost
- centos下安装xgboost
- win10下安装xgboost
- Ubuntu 下安装xgboost
- Windows 下安装 XGBoost
- linux下xgboost安装
- Linux下安装xgBoost
- Windows下安装XGBoost
- Linux 下安装xgboost
- Windows下安装xgboost
- Arduino Uno 水里水里去火里火里去 可高温防水 MAX6675热电偶温度传感器
- Web踩坑日记
- 指针与数组
- Java通过cal.get(Calendar.MONTH)比真实月份少了一个月
- 再谈HTTP通信
- Window下XGBoost安装
- python scrapy-redis
- mapreduce二次排序案例
- 集训被虐第一天7.31
- 列出1~1000内的所有素数(Python)
- IP地址划分、组播地址、公有IP、私有IP
- JAVA入门知识---小结
- ElasticSearch的head插件中如何使用cat接口
- Android编译错误error: ext4_allocate_best_fit_partial: failed to allocate 74 blocks, out of space?