xgboost在windows下的安装与使用

XGBoost wins many data science and machine learning challenges. Used in production by multiple companies.


下载:

使用Git Bash

git clone --recursive https://github.com/dmlc/xgboost

上面下载的是xgboost的最新版本,还不支持windows,截至到(16年7月25日)。

我们需要手动下载它的0.4x版本,xgboost-0.47

安装

它的安装步骤主要分为两步:

  • 首先打开xgboost-0.47源文件夹里的windows文件夹。使用 VS 打开xgboost.sln 工程。build the three shared library。我用的是2015社区版。
    这里写图片描述

这里写图片描述
官方说明是需要使用x64,release,可以根据自己实际做选择,X32的操作步骤也一样。

这里写图片描述

这里写图片描述
这时生成了xgboost.exe for CLI and xgboost_wrapper.dll for python

  • 然后在cmd里将路径改到xgboost文件夹里python-package目录cd C:\Users\Administrator\xgboost-0.47(根据自己的路径填写),在目录下执行python setup.py install。安装至此完成。

xgboost将会安装在你的python的Lib目录下,我用的Anaconda,所以在Anaconda下:
这里写图片描述


测试

在ipython里导入xgboost  import xgboost as xgb
这里写图片描述


可以用demo目录下的例子熟悉xgboost的使用。

xgboost/demo/

import xgboost as xgb
# read in data
dtrain = xgb.DMatrix('demo/data/agaricus.txt.train')
dtest = xgb.DMatrix('demo/data/agaricus.txt.test')
# specify parameters via map
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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值