1. 程式人生 > >xgboost學習筆記(1):安裝

xgboost學習筆記(1):安裝

背景

xgboost是GBDT演算法的實現,可以做迴歸,分類,和排序。支援各種語言呼叫,支援單機和分散式。非常適合於大規模資料集。


這裡寫圖片描述


- 專案主頁
- 安裝

安裝

我選擇了Python呼叫xgboost的方式。

從專案主頁下載原始碼,解壓。

[[email protected] qgzang]# git clone --recursive https://github.com/dmlc/xgboost
Cloning into 'xgboost'...
remote: Counting objects: 17097, done.
remote: Compressing objects: 100
% (17/17), done. remote: Total 17097 (delta 3), reused 0 (delta 0), pack-reused 17068 Receiving objects: 100% (17097/17097), 5.60 MiB | 948.00 KiB/s, done. Resolving deltas: 100% (10496/10496), done. Submodule 'dmlc-core' (https://github.com/dmlc/dmlc-core) registered for path 'dmlc-core' Submodule 'rabit' (https://github.com/dmlc/rabit) registered for
path 'rabit' Cloning into 'dmlc-core'... remote: Counting objects: 3545, done. remote: Total 3545 (delta 0), reused 0 (delta 0), pack-reused 3544 Receiving objects: 100% (3545/3545), 789.33 KiB | 181.00 KiB/s, done. Resolving deltas: 100% (2099/2099), done. Submodule path 'dmlc-core': checked out '9fd3b48462a7a651e12a197679f71e043dcb25a2'
Cloning into 'rabit'... remote: Counting objects: 3085, done. remote: Total 3085 (delta 0), reused 0 (delta 0), pack-reused 3085 Receiving objects: 100% (3085/3085), 881.50 KiB | 197.00 KiB/s, done. Resolving deltas: 100% (2004/2004), done. Submodule path 'rabit': checked out '8f61535b83e650331459d7f33a1615fa7d27b7bd' [[email protected] qgzang]# cd xgboost/ [[email protected] xgboost]# ll total 80 drwxr-xr-x. 2 root root 4096 622 15:18 amalgamation -rwxr-xr-x. 1 root root 759 622 15:18 build.sh -rw-r--r--. 1 root root 3548 622 15:18 CONTRIBUTORS.md drwxr-xr-x. 12 root root 4096 622 15:18 demo drwxr-xr-x. 12 root root 4096 622 15:18 dmlc-core drwxr-xr-x. 12 root root 4096 622 15:18 doc drwxr-xr-x. 3 root root 4096 622 15:18 include drwxr-xr-x. 6 root root 4096 622 15:18 jvm-packages -rw-r--r--. 1 root root 559 622 15:18 LICENSE drwxr-xr-x. 2 root root 4096 622 15:18 make -rw-r--r--. 1 root root 4988 622 15:18 Makefile -rw-r--r--. 1 root root 4087 622 15:18 NEWS.md drwxr-xr-x. 5 root root 4096 622 15:18 plugin drwxr-xr-x. 3 root root 4096 622 15:18 python-package drwxr-xr-x. 10 root root 4096 622 15:18 rabit -rw-r--r--. 1 root root 3843 622 15:18 README.md drwxr-xr-x. 9 root root 4096 622 15:18 R-package drwxr-xr-x. 9 root root 4096 622 15:18 src drwxr-xr-x. 5 root root 4096 622 15:18 tests

在解壓後的目錄下執行make命令安裝。

make -j4

安裝python版xgboost

在子資料夾python-package目錄下,執行python setup.py install。

[[email protected] xgboost]# cd python-package/
[[email protected] python-package]# ll
total 32
-rw-r--r--. 1 root root 4483 622 15:18 build_trouble_shooting.md
-rw-r--r--. 1 root root  372 622 15:18 MANIFEST.in
-rw-r--r--. 1 root root 2481 622 15:18 README.rst
-rw-r--r--. 1 root root   41 622 15:18 setup.cfg
-rw-r--r--. 1 root root 2277 622 15:18 setup_pip.py
-rw-r--r--. 1 root root 1559 622 15:18 setup.py
drwxr-xr-x. 2 root root 4096 622 15:18 xgboost
[[email protected] python-package]# python setup.py install
Install libxgboost from: ['/home/storage2T/qgzang/xgboost/python-package/xgboost/../../lib/libxgboost.so']
running install
running bdist_egg
running egg_info
creating xgboost.egg-info
writing requirements to xgboost.egg-info/requires.txt
writing xgboost.egg-info/PKG-INFO
writing top-level names to xgboost.egg-info/top_level.txt
writing dependency_links to xgboost.egg-info/dependency_links.txt
writing manifest file 'xgboost.egg-info/SOURCES.txt'
reading manifest file 'xgboost.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'xgboost/include'
warning: no files found matching '*' under directory 'xgboost/src'
warning: no previously-included files matching 'xgboost/build/*' found anywhere in distribution
warning: no previously-included files matching 'xgboost/*.o' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'xgboost.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/xgboost
copying xgboost/training.py -> build/lib/xgboost
copying xgboost/core.py -> build/lib/xgboost
copying xgboost/plotting.py -> build/lib/xgboost
copying xgboost/callback.py -> build/lib/xgboost
copying xgboost/__init__.py -> build/lib/xgboost
copying xgboost/libpath.py -> build/lib/xgboost
copying xgboost/compat.py -> build/lib/xgboost
copying xgboost/rabit.py -> build/lib/xgboost
copying xgboost/sklearn.py -> build/lib/xgboost
copying xgboost/VERSION -> build/lib/xgboost
copying xgboost/build-python.sh -> build/lib/xgboost
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/training.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/core.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/plotting.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/build-python.sh -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/callback.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/VERSION -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/__init__.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/libpath.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/compat.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/rabit.py -> build/bdist.linux-x86_64/egg/xgboost
copying build/lib/xgboost/sklearn.py -> build/bdist.linux-x86_64/egg/xgboost
byte-compiling build/bdist.linux-x86_64/egg/xgboost/training.py to training.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/core.py to core.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/plotting.py to plotting.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/callback.py to callback.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/libpath.py to libpath.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/compat.py to compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/rabit.py to rabit.pyc
byte-compiling build/bdist.linux-x86_64/egg/xgboost/sklearn.py to sklearn.pyc
installing package data to build/bdist.linux-x86_64/egg
running install_data
copying /home/storage2T/qgzang/xgboost/python-package/xgboost/../../lib/libxgboost.so -> build/bdist.linux-x86_64/egg/xgboost
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying xgboost.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/xgboost-0.4-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing xgboost-0.4-py2.7.egg
creating /root/anaconda2/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg
Extracting xgboost-0.4-py2.7.egg to /root/anaconda2/lib/python2.7/site-packages
Adding xgboost 0.4 to easy-install.pth file

Installed /root/anaconda2/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg
Processing dependencies for xgboost==0.4
Searching for scipy==0.17.0
Best match: scipy 0.17.0
Adding scipy 0.17.0 to easy-install.pth file

Using /root/anaconda2/lib/python2.7/site-packages
Searching for numpy==1.10.4
Best match: numpy 1.10.4
Adding numpy 1.10.4 to easy-install.pth file

Using /root/anaconda2/lib/python2.7/site-packages
Finished processing dependencies for xgboost==0.4

可能會缺失一些依賴庫需要安裝。比如在步驟二需要你安裝g++,在步驟三需要你安全python的一些數學庫。

測試是否安裝成功

ipython 裡匯入xgboost包

[[email protected] python-package]# ipython
Python 2.7.11 |Anaconda custom (64-bit)| (default, Dec  6 2015, 18:08:32)
Type "copyright", "credits" or "license" for more information.

IPython 4.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import xgboost as xgb

沒有報錯。

參考

相關推薦

xgboost學習筆記1安裝

背景 xgboost是GBDT演算法的實現,可以做迴歸,分類,和排序。支援各種語言呼叫,支援單機和分散式。非常適合於大規模資料集。 - 專案主頁 - 安裝 安裝 我選擇了Python呼叫xgboost的方式。 從專案主頁下載原始碼,

Redis學習筆記1Redis的說明與安裝

sets cti ansi c sde pos AR bsd 學習 ash Redis學習筆記(1):Redis說明的安裝 說明 什麽是Redis REmote DIctionary Server(Redis) 是一個由Salvatore Sanfilippo寫的key-v

SpringBoot學習筆記1配置Mybatis

target oca run class .com gpo connect auto users SpringBoot學習筆記(1):配置Mybatis 參考資料:   1.AndyLizh的博客   2.xiaolyuh123的博客 快速開始 添加Mybatis依賴(

Node.js學習筆記1Node.js快速開始

path 文本文 下載 啟動程序 直接 查看 學習筆記 完成後 編輯器 Node.js學習筆記(1):Node.js快速開始 Node.js的安裝 下載 官方網址:https://nodejs.org/en/ 說明:   在Windows上安裝時務必選擇全部組件,包括勾選

tensorflow學習筆記1sess.run()

原址:https://www.2cto.com/kf/201610/559887.html session.run() session.run([fetch1, fetch2]) import tensorflow as tf state = tf.Variable(0.0,dtype=

開源容器openshift學習筆記1新增Router元件

開篇之前如果沒有安裝openshift環境可以參考我的博文:centos7下安裝openshift 本系列部落格學習筆記參考《開源容器雲openshift》一書:下載連線:https://download.csdn.net/download/u012371097/10745382  

Redis 學習筆記1—— Redis安裝,String 型別測試

1 Redis 介紹 1.1 概述 Redis是一個開源,先進的key-value儲存,並用於構建高效能,可擴充套件的應用程式的完美解決方案。 Redis資料庫完全在記憶體中,使用磁碟僅用於永續性。 相比許多鍵值資料儲存,Redis擁有一套較為豐富的資料型別。

linux學習筆記1linux基礎知識

1.linux是什麼? Linux這個詞本身只表示Linux核心,但實際上人們已經習慣了用Linux來形容整個基於Linux核心,並且使用GNU 工程各種工具和資料庫的作業系統。 2. 什麼是shell 保護系統核心並對外提供操作介面的軟體 在linux中預設的

Shader學習筆記1Shader基礎

最近想學Shader,找到一個大佬的部落格,該筆記只是自己學習Shader的知識記錄,其實跟部落格的內容差不多,但是寫一遍,自己對shader的基礎更加清楚,這將是一個系列筆記,大佬部落格的地址: 1.unity提供的5種Shader模板 (1)Standard

Stuts2學習筆記1環境搭建及Demo

原始碼: github: https://github.com/liaotuo/Struts2-Demo/tree/master/struts2-demo 環境搭建 下載struts2 官網下載:http://mirror.bit.edu.cn/apache/struts

H264學習筆記1視訊壓縮編碼的基本原理

        陸陸續續學習H264有一段時間了,曾經以為自己可以在這方面大有作為,但是越是學習越發現,根本不存在能夠大幅度提升H264效能的方案,對於我這種水平的人來講。初次學習,概念的理解仍然很困難。在這裡我只是簡單淺顯的講一講我最近的讀書學習感想。        首先

Python學習筆記1圖片處理

基礎學習 在配置完開發環境之後,就可以開始Python的學習之路啦!首先是基礎知識的學習,可以根據自己的情況找到合適的教程,我用了一週的時間把慕課網上的Python教程 過了一遍。 過完一遍之後,發現印象不夠深刻,所以找一些小的練習來鞏固基礎。我選擇了Pyt

Caffe學習筆記1簡單的資料視覺化

caffe的底層是c++寫的,如果要進行資料視覺化,需要藉助其它的庫或者是介面,如opencv,python或者是matlab,python的環境需要自行配置,因為我使用的都是網管同志已經配置好的深度學習伺服器,所以不用管底層的一些配置問題,如果需要自行配置自己

WPF學習筆記1DataGrid單元格實現逐鍵過濾功能

    最近,開始學習WPF,其UI設計完全顛覆了傳統的設計理念,為程式設計師提供了極大的自由發揮空間,讓我為之驚歎,且為之著迷。然而,WPF在國內的熱度卻並不高,大部分貼子都是2012年以前的,出版的圖書也很少,參考的資料不多。為了避免在以後的程式設計中少走彎路,也防止自己遺忘,在此記錄

PostgreSQL學習筆記安裝

文章目錄 1. PostgreSQL是什麼? 2. 安裝和配置 2.1 CentOS7線上安裝 2.2 Ubuntu線上安裝 1. PostgreSQL是什麼? PostgreSQL

Qt-學習筆記1vs2015使用qt靜態庫5.7

一、QT靜態庫 可以自己編譯,也可以下載別人編譯好的,這裡是下載地址(QT靜態庫) 二、安裝Qt5Package 在vs2015的“擴充套件和更新”中尋找《Qt5Package》這個擴充套件,然後安裝,並重啟 開啟擴充套件QT5,配置QT靜態庫中的bin目錄,然後Re

TensorFlow學習筆記1LSTM相關程式碼

LSTM是seq2seq模型中經典的子結構,TensorFlow中提供了相應的結構,供我們使用: tensorflow提供了LSTM實現的一個basic版本,不包含lstm的一些高階擴充套件,同時也提供了一個標準介面,其中包含了lstm的擴充套件。分別為:tf.nn.rnn

Spring AOP學習筆記1AOP基礎知識

一、 使用AOP前的經驗 在接觸AOP這種程式設計思想之前,我也有好多的編碼經歷,將業務邏輯和日誌、測試和驗證等其他需求放在一起的,這簡直是痛苦死了,每寫一個方法都得重複好多程式碼,而且這些程式碼有好多是類似的,但是不得不重寫,因為當時還是菜鳥(現在也是菜鳥),比如之前同組

Spring 事務學習筆記1事務的基本知識

一、事務&&JDBC事務支援 在我的之前的spring操作資料庫中的文章很少提及事務,不是說它不重要,而是太重要,以至於spring專門有一部分來說明這一內容。之前可以說對事務幾乎沒有考慮過,只是知道把要進行的操作被事務包裹起來,就像在hibernate中進

資料結構學習筆記1Maximum Subsequence Sum最大子列和

問題思路分析:就是課堂上所講過的最大子列和問題,不過需要輸出子列頭和尾的項根據網上的資料,摹寫程式碼為具體實現:#include<iostream> using namespace std; int main (){ int N ; cin >>