【简明教程】windows下xgboost安装到python
生活随笔
收集整理的這篇文章主要介紹了
【简明教程】windows下xgboost安装到python
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- github clone
- 下載xgboost.dll
- 編譯
- 檢測
github clone
電腦上使用github
git clone https://github.com/dmlc/xgboost.git會在對應的目錄下,多出一個xgboost目錄。
下載xgboost.dll
- 訪問 http://www.picnet.com.au/blogs/guido/2016/09/22/xgboost-windows-x64-binaries-for-download/
- 在下面選一個,如果有cuda的話,就選GPU版本的,否則就選Not GPU
- 將下載的xgboost.dll文件放到git clone下來的python-package\xgboost文件夾中
編譯
進入到git clone下來的python-package文件夾中,進入命令行
輸入:Python setup.py install
檢測
D:\>python Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import xgboost D:\SoftWare\Python\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative usesimport imp >>> xr = xgboost.XGBRegressor() >>> import numpy as np >>> X = np.array([[1, 2, 3], [4, 5, 6]]) >>> y = np.array([1, 2]) >>> xr.fit(X, y) XGBRegressor(base_score=0.5, booster='gbtree', colsample_bylevel=1,colsample_bytree=1, gamma=0, importance_type='gain',learning_rate=0.1, max_delta_step=0, max_depth=3,min_child_weight=1, missing=None, n_estimators=100, n_jobs=1,nthread=None, objective='reg:linear', random_state=0, reg_alpha=0,reg_lambda=1, scale_pos_weight=1, seed=None, silent=True,subsample=1) >>> X_t = np.array([[1, 2, 3],]) >>> xr.predict(X_t) array([0.9978384], dtype=float32)總結
以上是生活随笔為你收集整理的【简明教程】windows下xgboost安装到python的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【opencv】边缘高斯模糊(canny
- 下一篇: 五种排序方式gif展示【python】