<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 如何在 macOS 上為 Python 安裝 XGBoost > 原文: [https://machinelearningmastery.com/install-xgboost-python-macos/](https://machinelearningmastery.com/install-xgboost-python-macos/) XGBoost 是一個用于開發非常快速和準確的梯度提升模型的庫。 它是 Kaggle 數據科學競賽中許多獲獎解決方案中心的圖書館。 在本教程中,您將了解如何在 macOS 上安裝 Python 的 XGBoost 庫。 讓我們開始吧。 ![How to Install XGBoost for Python on macOS](https://img.kancloud.cn/69/23/6923669129bd4c1f330f90b9198aceee_640x427.jpg) 如何在 macOS 上安裝 XGBoost for Python 照片來自 [auntjojo](https://www.flickr.com/photos/7682623@N02/7944342576/) ,保留一些權利。 ## 教程概述 本教程分為 3 個部分;他們是: 1. 安裝 MacPorts 2. 構建 XGBoost 3. 安裝 XGBoost **注意**:我已經在一系列不同的 macOS 版本上使用了這個程序多年,并且沒有改變。本教程是在 macOS High Sierra(10.13.1)上編寫和測試的。 ## 1.安裝 MacPorts 您需要安裝 GCC 和 Python 環境才能構建和安裝 XGBoost for Python。 我推薦使用 GCC 7 和 Python 3.6,我建議使用 [MacPorts](https://www.macports.org/) 安裝這些先決條件。 * 1.有關逐步安裝 MacPorts 和 Python 環境的幫助,請參閱本教程: [&gt;&gt;如何在 Mac OS X 上安裝 Python 3 環境以進行機器學習和深度學習](https://machinelearningmastery.com/install-python-3-environment-mac-os-x-machine-learning-deep-learning/) * 2.安裝 MacPorts 和可用的 Python 環境后,您可以按如下方式安裝和選擇 GCC 7: ```py sudo port install gcc7 sudo port select --set gcc mp-gcc7 ``` * 3.確認您的 GCC 安裝成功,如下所示: ```py gcc -v ``` 你應該看到印刷版的 GCC;例如: ```py .. gcc version 7.2.0 (MacPorts gcc7 7.2.0_0) ``` 你看到什么版本? 請在下面的評論中告訴我。 ## 2.構建 XGBoost 下一步是為您的系統下載并編譯 XGBoost。 * 1.首先,從 GitHub 查看代碼庫: ```py git clone --recursive https://github.com/dmlc/xgboost ``` * 2.轉到 xgboost 目錄。 ```py cd xgboost/ ``` * 3.復制我們打算用來將 XGBoost 編譯到位的配置。 ```py cp make/config.mk ./config.mk ``` * 4.編譯 XGBoost;這要求您指定系統上的核心數(例如,8,根據需要進行更改)。 ```py make -j8 ``` 構建過程可能需要一分鐘,不應產生任何錯誤消息,盡管您可能會看到一些可以安全忽略的警告。 例如,編譯的最后一個片段可能如下所示: ```py ... a - build/learner.o a - build/logging.o a - build/c_api/c_api.o a - build/c_api/c_api_error.o a - build/common/common.o a - build/common/hist_util.o a - build/data/data.o a - build/data/simple_csr_source.o a - build/data/simple_dmatrix.o a - build/data/sparse_page_dmatrix.o a - build/data/sparse_page_raw_format.o a - build/data/sparse_page_source.o a - build/data/sparse_page_writer.o a - build/gbm/gblinear.o a - build/gbm/gbm.o a - build/gbm/gbtree.o a - build/metric/elementwise_metric.o a - build/metric/metric.o a - build/metric/multiclass_metric.o a - build/metric/rank_metric.o a - build/objective/multiclass_obj.o a - build/objective/objective.o a - build/objective/rank_obj.o a - build/objective/regression_obj.o a - build/predictor/cpu_predictor.o a - build/predictor/predictor.o a - build/tree/tree_model.o a - build/tree/tree_updater.o a - build/tree/updater_colmaker.o a - build/tree/updater_fast_hist.o a - build/tree/updater_histmaker.o a - build/tree/updater_prune.o a - build/tree/updater_refresh.o a - build/tree/updater_skmaker.o a - build/tree/updater_sync.o c++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -o xgboost build/cli_main.o build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/common/hist_util.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/predictor/cpu_predictor.o build/predictor/predictor.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_fast_hist.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit.a -pthread -lm -fopenmp ``` 這一步對你有用嗎? 請在下面的評論中告訴我。 ## 3.安裝 XGBoost 您現在可以在系統上安裝 XGBoost 了。 * 1.將目錄更改為 xgboost 項目的 Python 包。 ```py cd python-package ``` * 2.安裝 Python XGBoost 包。 ```py sudo python setup.py install ``` 安裝非常快。 例如,在安裝結束時,您可能會看到如下消息: ```py ... Installed /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/xgboost-0.6-py3.6.egg Processing dependencies for xgboost==0.6 Searching for scipy==1.0.0 Best match: scipy 1.0.0 Adding scipy 1.0.0 to easy-install.pth file Using /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages Searching for numpy==1.13.3 Best match: numpy 1.13.3 Adding numpy 1.13.3 to easy-install.pth file Using /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages Finished processing dependencies for xgboost==0.6 ``` * 3.通過打印 xgboost 版本確認安裝是否成功,這需要加載庫。 將以下代碼保存到名為 _version.py 的文件中。_ ```py import xgboost print("xgboost", xgboost.__version__) ``` 從命令行運行腳本: ```py python version.py ``` 您應該看到 XGBoost 版本打印到屏幕: ```py xgboost 0.6 ``` 你是怎么做的? 在以下評論中發布您的結果。 ## 進一步閱讀 如果您希望深入了解,本節將提供有關該主題的更多資源。 * [如何在 Mac OS X 上安裝 Python 3 環境以進行機器學習和深度學習](https://machinelearningmastery.com/install-python-3-environment-mac-os-x-machine-learning-deep-learning/) * [MacPorts 安裝指南](https://www.macports.org/install.php) * [XGBoost 安裝指南](http://xgboost.readthedocs.io/en/latest/build.html) ## 摘要 在本教程中,您了解了如何在 macOS 上逐步安裝 XGBoost for Python。 你有任何問題嗎? 在下面的評論中提出您的問題,我會盡力回答。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看