├── .gitignore ├── .nojekyll ├── 404.html ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── SUMMARY.md ├── asset ├── docsify-apachecn-footer.js ├── docsify-baidu-push.js ├── docsify-baidu-stat.js ├── docsify-clicker.js ├── docsify-cnzz.js ├── docsify-copy-code.min.js ├── docsify.min.js ├── prism-darcula.css ├── search.min.js ├── style.css └── vue.css ├── docs ├── 0.72 │ ├── 1.md │ ├── 10.md │ ├── 11.md │ ├── 12.md │ ├── 13.md │ ├── 14.md │ ├── 15.md │ ├── 2.md │ ├── 3.md │ ├── 4.md │ ├── 5.md │ ├── 6.md │ ├── 7.md │ ├── 8.md │ ├── 9.md │ ├── CONTRIBUTING.md │ ├── README.md │ └── SUMMARY.md ├── 0.90 │ ├── CONTRIBUTING.md │ ├── README.md │ └── SUMMARY.md ├── 1.md ├── 10.md ├── 11.md ├── 12.md ├── 13.md ├── 14.md ├── 15.md ├── 2.md ├── 3.md ├── 4.md ├── 5.md ├── 6.md ├── 7.md ├── 8.md ├── 9.md └── img │ ├── 0.72 │ ├── 0507a5548594983588fdc7c98687b36b.jpg │ ├── 09858ff3ca719faf578ad5b13b3c98fa.jpg │ ├── 0d22e8726e5829598054d2585d7c9370.jpg │ ├── 11710d80af8ff3712f529745adf5409a.jpg │ ├── 1476c1e968148d38644efcce09c2bef4.jpg │ ├── 17131c421b074dc314397e82a4528438.jpg │ ├── 1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg │ ├── 1d3fcd8d09d65c0ee710f95bf8422ad9.jpg │ ├── 1fe2cf4fb357117e177388becb68d9f9.jpg │ ├── 228674793358bc993a8dcb3c2861a3ee.jpg │ ├── 25bce8f7365849fcbccf06c572280bfd.jpg │ ├── 2c05306f7baa0066128b8f8afd95ec37.jpg │ ├── 2c864507ad886978650e8f67f3224afe.jpg │ ├── 2d3bec80be56303ea525a39cd4395d5c.jpg │ ├── 35b6f55e2b5953ff94ee568f744b4efb.jpg │ ├── 390b4cd4db1c07e3db74b0810913ffc8.jpg │ ├── 3c11d8d84433d2138c31a421b1be11c7.jpg │ ├── 40168c626a126a5ece60aa03c2ef69b0.jpg │ ├── 4028c0134b3b847f0e97b4cd284bc927.jpg │ ├── 4194e8522c4e867f714b492a4439dae8.jpg │ ├── 4330c12a952e7f831231b51700bcd390.jpg │ ├── 43354e497c557600517f0d5839d8c4e7.jpg │ ├── 4451c509ff07f4326844859d1bbb7a56.jpg │ ├── 4c8dff663d8cee873b593e54d56baccb.jpg │ ├── 4dc70a02830b485f3f26015c8fb1fdb9.jpg │ ├── 4ef880d0d67e58f282ce4ed79d4f9549.jpg │ ├── 51b7cc80809f3eada5745a2e5f79b18d.jpg │ ├── 560afea477f6995994b0cfff8262e34d.jpg │ ├── 585ba860aa933d05565a569d8d1ddf93.jpg │ ├── 5aa5a49c3668860ed0ac3e6b62d3cc93.jpg │ ├── 5ec429f9c4fa5c7660b705bcf8723ac9.jpg │ ├── 654b00d1036ba7f7d93e02f57fc00a75.jpg │ ├── 683c9a76e2b8489a4a3d0ffdec2ad441.jpg │ ├── 728afccdae39c1bac6479386dab442e8.jpg │ ├── 77116c2aaf28d1d862f8095806911151.jpg │ ├── 7d80469ba9822a0d05b7140b4ca0290a.jpg │ ├── 87142829e4107d70b9cae3f8b2d095fc.jpg │ ├── 8a5adca27b799741caabbdeae20be5cf.jpg │ ├── 8c50b9fb6c2c85cbc672ab618d01c39b.jpg │ ├── 8e83474bbce57dfc2d0399adceb655b3.jpg │ ├── 907939506800cf89ad2ed0d2d05cfabc.jpg │ ├── 94f79ae2273f820cc565fdebf14a9f63.jpg │ ├── 98b4f83629c037523fd162ed4b216f51.jpg │ ├── a3b9b8a59a7320d10d212f59e05036c4.jpg │ ├── a787da64e8c74cd0b52223ce8d686f68.jpg │ ├── a96052742f7423a92cfcad03a185fa63.jpg │ ├── aa297e24fc75c747a07b290638760b43.jpg │ ├── ab0e7d4ab7d7b6e0a5aa4383fcdd2ee5.jpg │ ├── ad3e76b49257d997698faa2d585c2a0a.jpg │ ├── af220a242098880c9f5524587fac68c5.jpg │ ├── b201e8f1610bd6f5f4a4799b885df578.jpg │ ├── b8afcf3f3647596ed0584af454f840a9.jpg │ ├── b999689ef453cce06ffd631a571e1f29.jpg │ ├── bac9598d3338ed61b7a118621dedea77.jpg │ ├── c347c8efe6d5830b8c0cf3828e8275db.jpg │ ├── c9379d9b2e521341735b00d845051d04.jpg │ ├── cdab9437b701fd21fb3294cfba7c4bc2.jpg │ ├── ce9bf02722174f83b83dc21985022455.jpg │ ├── d9d5f5978eda3e268a05e689f897c9c6.jpg │ ├── d9f69ea79be64a6a07e67d338aafe6aa.jpg │ ├── dd45717d5b8500473d4d5cc5e8da2d43.jpg │ ├── f3d01ce46b3fe38877c9cc0f7d12db03.jpg │ ├── f9a24042b2fe37eb28c8462d0195c985.jpg │ └── ff439882e70c47df87d58c837a372490.jpg │ └── logo.png ├── index.html └── update.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | .DS_Store 103 | 104 | # gitbook 105 | _book 106 | 107 | # node.js 108 | node_modules 109 | 110 | # windows 111 | Thumbs.db 112 | 113 | # word 114 | ~$*.docx 115 | ~$*.doc 116 | 117 | # custom 118 | docs/README.md 119 | -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/.nojekyll -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /404.html 3 | --- 4 | 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 贡献指南 2 | 3 | > 请您勇敢地去翻译和改进翻译。虽然我们追求卓越,但我们并不要求您做到十全十美,因此请不要担心因为翻译上犯错——在大部分情况下,我们的服务器已经记录所有的翻译,因此您不必担心会因为您的失误遭到无法挽回的破坏。(改编自维基百科) 4 | 5 | 可能有用的链接: 6 | 7 | + [0.72 中文文档](https://xgboost.apachecn.org/docs/0.72) 8 | + [0.72 英文文档](https://xgboost.readthedocs.io/en/release_0.72) 9 | 10 | 负责人: 11 | 12 | * [1266](https://github.com/wangweitong): 1097828409 13 | * [腻味](https://github.com/xxxx): 1185685810 14 | 15 | ## 章节列表 16 | 17 | * [Introduction](README.md) 18 | * [安装指南](https://xgboost.readthedocs.io/en/latest/build.html) 19 | * [XGBoost入门](https://xgboost.readthedocs.io/en/latest/get_started.html) 20 | * [XGBoost教程](https://xgboost.readthedocs.io/en/latest/tutorials/index.html) 21 | * [Boosted Trees简介](https://xgboost.readthedocs.io/en/latest/tutorials/model.html) 22 | * [使用AWS YARN分布式XGBoost](https://xgboost.readthedocs.io/en/latest/tutorials/aws_yarn.html) 23 | * [使用XGBoost4J-Spark的分布式XGBoost](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 24 | * [DART助推器](https://xgboost.readthedocs.io/en/latest/tutorials/dart.html) 25 | * [单调约束](https://xgboost.readthedocs.io/en/latest/tutorials/monotonic.html) 26 | * [XGBoost中的随机森林](https://xgboost.readthedocs.io/en/latest/tutorials/rf.html) 27 | * [特征交互约束](https://xgboost.readthedocs.io/en/latest/tutorials/feature_interaction_constraint.html) 28 | * [DMatrix的文本输入格式](https://xgboost.readthedocs.io/en/latest/tutorials/input_format.html) 29 | * [参数调整注意事项](https://xgboost.readthedocs.io/en/latest/tutorials/param_tuning.html) 30 | * [使用XGBoost外部存储器版本(测试版)](https://xgboost.readthedocs.io/en/latest/tutorials/external_memory.html) 31 | * [自定义目标和评估指标](https://xgboost.readthedocs.io/en/latest/tutorials/custom_metric_obj.html) 32 | * [经常问的问题](https://xgboost.readthedocs.io/en/latest/faq.html) 33 | * [XGBoost用户论坛](https://discuss.xgboost.ai/) 34 | * [GPU支持](https://xgboost.readthedocs.io/en/latest/gpu/index.html) 35 | * [XGBoost参数](https://xgboost.readthedocs.io/en/latest/parameter.html) 36 | * [Python包](https://xgboost.readthedocs.io/en/latest/python/index.html) 37 | * [Python包介绍](https://xgboost.readthedocs.io/en/latest/python/python_intro.html) 38 | * [Python API参考](https://xgboost.readthedocs.io/en/latest/python/python_api.html) 39 | * [Python示例](https://github.com/dmlc/xgboost/tree/master/demo/guide-python) 40 | * [R包](https://xgboost.readthedocs.io/en/latest/R-package/index.html) 41 | * [R中的XGBoost简介](https://xgboost.readthedocs.io/en/latest/R-package/xgboostPresentation.html) 42 | * [使用XGBoost了解您的数据集](https://xgboost.readthedocs.io/en/latest/R-package/discoverYourData.html) 43 | * [JVM包](https://xgboost.readthedocs.io/en/latest/jvm/index.html) 44 | * [XGBoost4J入门](https://xgboost.readthedocs.io/en/latest/jvm/java_intro.html) 45 | * [XGBoost4J-Spark教程](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 46 | * [代码示例](https://github.com/dmlc/xgboost/tree/master/jvm-packages/xgboost4j-example) 47 | * [XGBoost4J Java API](https://xgboost.readthedocs.io/en/latest/jvm/javadocs/index.html) 48 | * [XGBoost4J Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j/index.html) 49 | * [XGBoost4J-Spark Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-spark/index.html) 50 | * [XGBoost4J-Flink Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-flink/index.html) 51 | * [Julia包](https://xgboost.readthedocs.io/en/latest/julia.html) 52 | * [CLI界面](https://xgboost.readthedocs.io/en/latest/cli.html) 53 | * [有助于XGBoost](https://xgboost.readthedocs.io/en/latest/contribute.html) 54 | 55 | ## 流程 56 | 57 | ### 一、认领 58 | 59 | 首先查看[整体进度](https://github.com/apachecn/pytorch-doc-zh/issues/274),确认没有人认领了你想认领的章节。 60 | 61 | 然后回复 ISSUE,注明“章节 + QQ 号”(一定要留 QQ)。 62 | 63 | ### 二、翻译 64 | 65 | 可以合理利用翻译引擎(例如[谷歌](https://translate.google.cn/)),但一定要把它变得可读! 66 | 67 | 可以参照之前版本的中文文档,如果有用的话。 68 | 69 | 如果遇到格式问题,请随手把它改正。 70 | 71 | ### 三、提交 72 | 73 | **提交的时候不要改动文件名称,即使它跟章节标题不一样也不要改,因为文件名和原文的链接是对应的!!!** 74 | 75 | + `fork` Github 项目 76 | + 将译文放在`docs/0.90`文件夹下 77 | + `push` 78 | + `pull request` 79 | 80 | 请见 [Github 入门指南](https://github.com/apachecn/kaggle/blob/master/docs/GitHub)。 81 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM httpd:2.4 2 | COPY ./ /usr/local/apache2/htdocs/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0) 2 | 3 | Copyright © 2020 ApacheCN(apachecn@163.com) 4 | 5 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 6 | 7 | Section 1 – Definitions. 8 | 9 | a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 10 | b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 11 | c. BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. 12 | d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 13 | e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 14 | f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 15 | g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike. 16 | h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 17 | i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 18 | j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. 19 | k. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 20 | l. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 21 | m. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 22 | n. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 23 | 24 | Section 2 – Scope. 25 | 26 | a. License grant. 27 | 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 28 | A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 29 | B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 30 | 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 31 | 3. Term. The term of this Public License is specified in Section 6(a). 32 | 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 33 | 5. Downstream recipients. 34 | A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 35 | B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. 36 | C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 37 | 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 38 | b. Other rights. 39 | 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 40 | 2. Patent and trademark rights are not licensed under this Public License. 41 | 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 42 | 43 | Section 3 – License Conditions. 44 | 45 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 46 | 47 | a. Attribution. 48 | 1. If You Share the Licensed Material (including in modified form), You must: 49 | A. retain the following if it is supplied by the Licensor with the Licensed Material: 50 | i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 51 | ii. a copyright notice; 52 | iii. a notice that refers to this Public License; 53 | iv. a notice that refers to the disclaimer of warranties; 54 | v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 55 | B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 56 | C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 57 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 58 | 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 59 | b. ShareAlike. 60 | In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 61 | 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License. 62 | 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 63 | 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. 64 | 65 | Section 4 – Sui Generis Database Rights. 66 | 67 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 68 | 69 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 70 | b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and 71 | c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 72 | 73 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 74 | 75 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 76 | 77 | a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. 78 | b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. 79 | c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 80 | 81 | Section 6 – Term and Termination. 82 | 83 | a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 84 | b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 85 | 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 86 | 2. upon express reinstatement by the Licensor. 87 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 88 | c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 89 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 90 | 91 | Section 7 – Other Terms and Conditions. 92 | 93 | a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 94 | b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 95 | 96 | Section 8 – Interpretation. 97 | 98 | a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 99 | b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 100 | c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 101 | d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #
XGBoost 中文文档
2 | 3 | ![](docs/img/logo.png) 4 | 5 | XGBoost是一个优化的分布式梯度增强库,旨在实现高效,灵活和便携。 6 | 7 | 它在 [Gradient Boosting](https://en.wikipedia.org/wiki/Gradient_boosting) 框架下实现机器学习算法。XGBoost提供并行树提升(也称为GBDT,GBM),可以快速准确地解决许多数据科学问题。相同的代码在主要的分布式环境(Hadoop,SGE,MPI)上运行,并且可以解决数十亿个示例之外的问题。 8 | 9 | > 程序员的麻烦在于,你无法弄清他在捣腾什么,当你最终弄明白时,也许已经晚了。——Seymour Cray 10 | 11 | * [中文地址](https://xgboost.apachecn.org/) 12 | * [英文地址](https://xgboost.ai/) 13 | * [ApacheCN 机器学习交流群 629470233](http://shang.qq.com/wpa/qunwpa?idkey=30e5f1123a79867570f665aa3a483ca404b1c3f77737bc01ec520ed5f078ddef) 14 | * [ApacheCN 学习资源](https://www.ibooker.org.cn/docs) 15 | 16 | ## 翻译进度 17 | 18 | [**贡献指南**](CONTRIBUTING.md) 19 | 20 | > 项目翻译 xgboost 0.90 21 | 22 | * 贡献者: 记得留言和更新翻译进度 23 | * 地址: https://github.com/apachecn/xgboost-doc-zh/issues/27 24 | 25 | ## 项目看板 26 | 27 | > 项目 XGBoost 0.90 看板 28 | 29 | * 负责人: 记得更新和优化 30 | * 地址: https://github.com/apachecn/xgboost-doc-zh/projects/1 31 | 32 | 33 | ## 项目负责人 34 | 35 | 格式: GitHub + QQ 36 | 37 | > 第一期 (2017-xx-xx) 38 | 39 | * [那伊抹微笑](https://github.com/wangyangting): 1042658081 40 | * [Peppa](https://github.com/chenyyx): 190442212 41 | 42 | > 第2期 (2019-07-07) 43 | 44 | * [1266](https://github.com/wangweitong): 1097828409 45 | * [腻味](https://github.com/XuQiao318): 1185685810 46 | 47 | -- 负责人要求: (欢迎一起为 `XGBoost 中文版本` 做贡献) 48 | 49 | * 热爱开源,喜欢装逼 50 | * 长期使用 XGBoost 51 | * 能够有时间及时优化页面bug和用户issues 52 | * 试用期: 2个月 53 | * 欢迎联系: [片刻](https://github.com/jiangzhonglian) 529815144 54 | 55 | 56 | ## 建议反馈 57 | 58 | * 在我们的 [apachecn/xgboost-doc-zh](https://github.com/apachecn/xgboost-doc-zh) github 上提 issue. 59 | * 发邮件到 Email: `apachecn@163.com`. 60 | * 在我们的 [QQ群-搜索: 交流方式](https://github.com/apachecn/home) 中联系群主/管理员即可. 61 | 62 | ## 下载 63 | 64 | ### Docker 65 | 66 | ``` 67 | docker pull apachecn0/xgboost-doc-zh 68 | docker run -tid -p :80 apachecn0/xgboost-doc-zh 69 | # 访问 http://localhost:{port} 查看文档 70 | ``` 71 | 72 | ### PYPI 73 | 74 | ``` 75 | pip install xgboost-doc-zh 76 | xgboost-doc-zh 77 | # 访问 http://localhost:{port} 查看文档 78 | ``` 79 | 80 | ### NPM 81 | 82 | ``` 83 | npm install -g xgboost-doc-zh 84 | xgboost-doc-zh 85 | # 访问 http://localhost:{port} 查看文档 86 | ``` 87 | 88 | ## 赞助我们 89 | 90 | 微信&支付宝 91 | 92 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | + [Introduction](README.md) 4 | + [开始使用 XGBoost](docs/1.md) 5 | + [XGBoost 教程](docs/2.md) 6 | + [Boosted Trees 介绍](docs/3.md) 7 | + [AWS 上的分布式 XGBoost YARN](docs/4.md) 8 | + [DART booster](docs/5.md) 9 | + [XGBoost 入门指引](docs/6.md) 10 | + 安装 11 | + [安装指南](docs/7.md) 12 | + 以特定的方式使用 XGBoost 13 | + [参数调整注意事项](docs/8.md) 14 | + [使用 XGBoost 外部存储器版本(测试版)](docs/9.md) 15 | + 开发和破解 XGBoost 16 | + [为 XGBoost 做贡献](docs/10.md) 17 | + [常见问题](docs/11.md) 18 | + [XGBoost Python Package](docs/12.md) 19 | + [Python 软件包介绍](docs/13.md) 20 | + [Python API 参考](docs/14.md) 21 | + [XGBoost 参数](docs/15.md) 22 | -------------------------------------------------------------------------------- /asset/docsify-apachecn-footer.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var footer = [ 3 | '
', 4 | '
', 5 | '

我们一直在努力

', 6 | '

apachecn/xgboost-doc-zh

', 7 | '

', 8 | ' ', 9 | ' ', 10 | ' ML | ApacheCN

', 11 | '

', 12 | '
', 13 | ' ', 17 | '
', 18 | '
' 19 | ].join('\n') 20 | var plugin = function(hook) { 21 | hook.afterEach(function(html) { 22 | return html + footer 23 | }) 24 | hook.doneEach(function() { 25 | (adsbygoogle = window.adsbygoogle || []).push({}) 26 | }) 27 | } 28 | var plugins = window.$docsify.plugins || [] 29 | plugins.push(plugin) 30 | window.$docsify.plugins = plugins 31 | })() -------------------------------------------------------------------------------- /asset/docsify-baidu-push.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var plugin = function(hook) { 3 | hook.doneEach(function() { 4 | new Image().src = 5 | '//api.share.baidu.com/s.gif?r=' + 6 | encodeURIComponent(document.referrer) + 7 | "&l=" + encodeURIComponent(location.href) 8 | }) 9 | } 10 | var plugins = window.$docsify.plugins || [] 11 | plugins.push(plugin) 12 | window.$docsify.plugins = plugins 13 | })() -------------------------------------------------------------------------------- /asset/docsify-baidu-stat.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var plugin = function(hook) { 3 | hook.doneEach(function() { 4 | window._hmt = window._hmt || [] 5 | var hm = document.createElement("script") 6 | hm.src = "https://hm.baidu.com/hm.js?" + window.$docsify.bdStatId 7 | document.querySelector("article").appendChild(hm) 8 | }) 9 | } 10 | var plugins = window.$docsify.plugins || [] 11 | plugins.push(plugin) 12 | window.$docsify.plugins = plugins 13 | })() -------------------------------------------------------------------------------- /asset/docsify-clicker.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var ids = [ 3 | '109577065', '108852955', '102682374', '100520874', '92400861', '90312982', 4 | '109963325', '109323014', '109301511', '108898970', '108590722', '108538676', 5 | '108503526', '108437109', '108402202', '108292691', '108291153', '108268498', 6 | '108030854', '107867070', '107847299', '107827334', '107825454', '107802131', 7 | '107775320', '107752974', '107735139', '107702571', '107598864', '107584507', 8 | '107568311', '107526159', '107452391', '107437455', '107430050', '107395781', 9 | '107325304', '107283210', '107107145', '107085440', '106995421', '106993460', 10 | '106972215', '106959775', '106766787', '106749609', '106745967', '106634313', 11 | '106451602', '106180097', '106095505', '106077010', '106008089', '106002346', 12 | '105653809', '105647855', '105130705', '104837872', '104706815', '104192620', 13 | '104074941', '104040537', '103962171', '103793502', '103783460', '103774572', 14 | '103547748', '103547703', '103547571', '103490757', '103413481', '103341935', 15 | '103330191', '103246597', '103235808', '103204403', '103075981', '103015105', 16 | '103014899', '103014785', '103014702', '103014540', '102993780', '102993754', 17 | '102993680', '102958443', '102913317', '102903382', '102874766', '102870470', 18 | '102864513', '102811179', '102761237', '102711565', '102645443', '102621845', 19 | '102596167', '102593333', '102585262', '102558427', '102537547', '102530610', 20 | '102527017', '102504698', '102489806', '102372981', '102258897', '102257303', 21 | '102056248', '101920097', '101648638', '101516708', '101350577', '101268149', 22 | '101128167', '101107328', '101053939', '101038866', '100977414', '100945061', 23 | '100932401', '100886407', '100797378', '100634918', '100588305', '100572447', 24 | '100192249', '100153559', '100099032', '100061455', '100035392', '100033450', 25 | '99671267', '99624846', '99172551', '98992150', '98989508', '98987516', '98938304', 26 | '98937682', '98725145', '98521688', '98450861', '98306787', '98203342', '98026348', 27 | '97680167', '97492426', '97108940', '96888872', '96568559', '96509100', '96508938', 28 | '96508611', '96508374', '96498314', '96476494', '96333593', '96101522', '95989273', 29 | '95960507', '95771870', '95770611', '95766810', '95727700', '95588929', '95218707', 30 | '95073151', '95054615', '95016540', '94868371', '94839549', '94719281', '94401578', 31 | '93931439', '93853494', '93198026', '92397889', '92063437', '91635930', '91433989', 32 | '91128193', '90915507', '90752423', '90738421', '90725712', '90725083', '90722238', 33 | '90647220', '90604415', '90544478', '90379769', '90288341', '90183695', '90144066', 34 | '90108283', '90021771', '89914471', '89876284', '89852050', '89839033', '89812373', 35 | '89789699', '89786189', '89752620', '89636380', '89632889', '89525811', '89480625', 36 | '89464088', '89464025', '89463984', '89463925', '89445280', '89441793', '89430432', 37 | '89429877', '89416176', '89412750', '89409618', '89409485', '89409365', '89409292', 38 | '89409222', '89399738', '89399674', '89399526', '89355336', '89330241', '89308077', 39 | '89222240', '89140953', '89139942', '89134398', '89069355', '89049266', '89035735', 40 | '89004259', '88925790', '88925049', '88915838', '88912706', '88911548', '88899438', 41 | '88878890', '88837519', '88832555', '88824257', '88777952', '88752158', '88659061', 42 | '88615256', '88551434', '88375675', '88322134', '88322085', '88321996', '88321978', 43 | '88321950', '88321931', '88321919', '88321899', '88321830', '88321756', '88321710', 44 | '88321661', '88321632', '88321566', '88321550', '88321506', '88321475', '88321440', 45 | '88321409', '88321362', '88321321', '88321293', '88321226', '88232699', '88094874', 46 | '88090899', '88090784', '88089091', '88048808', '87938224', '87913318', '87905933', 47 | '87897358', '87856753', '87856461', '87827666', '87822008', '87821456', '87739137', 48 | '87734022', '87643633', '87624617', '87602909', '87548744', '87548689', '87548624', 49 | '87548550', '87548461', '87463201', '87385913', '87344048', '87078109', '87074784', 50 | '87004367', '86997632', '86997466', '86997303', '86997116', '86996474', '86995899', 51 | '86892769', '86892654', '86892569', '86892457', '86892347', '86892239', '86892124', 52 | '86798671', '86777307', '86762845', '86760008', '86759962', '86759944', '86759930', 53 | '86759922', '86759646', '86759638', '86759633', '86759622', '86759611', '86759602', 54 | '86759596', '86759591', '86759580', '86759572', '86759567', '86759558', '86759545', 55 | '86759534', '86749811', '86741502', '86741074', '86741059', '86741020', '86740897', 56 | '86694754', '86670104', '86651882', '86651875', '86651866', '86651828', '86651790', 57 | '86651767', '86651756', '86651735', '86651720', '86651708', '86618534', '86618526', 58 | '86594785', '86590937', '86550497', '86550481', '86550472', '86550453', '86550438', 59 | '86550429', '86550407', '86550381', '86550359', '86536071', '86536035', '86536014', 60 | '86535988', '86535963', '86535953', '86535932', '86535902', '86472491', '86472298', 61 | '86472236', '86472191', '86472108', '86471967', '86471899', '86471822', '86439022', 62 | '86438972', '86438902', '86438887', '86438867', '86438836', '86438818', '85850119', 63 | '85850075', '85850021', '85849945', '85849893', '85849837', '85849790', '85849740', 64 | '85849661', '85849620', '85849550', '85606096', '85564441', '85547709', '85471981', 65 | '85471317', '85471136', '85471073', '85470629', '85470456', '85470169', '85469996', 66 | '85469877', '85469775', '85469651', '85469331', '85469033', '85345768', '85345742', 67 | '85337900', '85337879', '85337860', '85337833', '85337797', '85322822', '85322810', 68 | '85322791', '85322745', '85317667', '85265742', '85265696', '85265618', '85265350', 69 | '85098457', '85057670', '85009890', '84755581', '84637437', '84637431', '84637393', 70 | '84637374', '84637355', '84637338', '84637321', '84637305', '84637283', '84637259', 71 | '84629399', '84629314', '84629233', '84629124', '84629065', '84628997', '84628933', 72 | '84628838', '84628777', '84628690', '84591581', '84591553', '84591511', '84591484', 73 | '84591468', '84591416', '84591386', '84591350', '84591308', '84572155', '84572107', 74 | '84503228', '84500221', '84403516', '84403496', '84403473', '84403442', '84075703', 75 | '84029659', '83933480', '83933459', '83933435', '83903298', '83903274', '83903258', 76 | '83752369', '83345186', '83116487', '83116446', '83116402', '83116334', '83116213', 77 | '82944248', '82941023', '82938777', '82936611', '82932735', '82918102', '82911085', 78 | '82888399', '82884263', '82883507', '82880996', '82875334', '82864060', '82831039', 79 | '82823385', '82795277', '82790832', '82775718', '82752022', '82730437', '82718126', 80 | '82661646', '82588279', '82588267', '82588261', '82588192', '82347066', '82056138', 81 | '81978722', '81211571', '81104145', '81069048', '81006768', '80788365', '80767582', 82 | '80759172', '80759144', '80759129', '80736927', '80661288', '80616304', '80602366', 83 | '80584625', '80561364', '80549878', '80549875', '80541470', '80539726', '80531328', 84 | '80513257', '80469816', '80406810', '80356781', '80334130', '80333252', '80332666', 85 | '80332389', '80311244', '80301070', '80295974', '80292252', '80286963', '80279504', 86 | '80278369', '80274371', '80249825', '80247284', '80223054', '80219559', '80209778', 87 | '80200279', '80164236', '80160900', '80153046', '80149560', '80144670', '80061205', 88 | '80046520', '80025644', '80014721', '80005213', '80004664', '80001653', '79990178', 89 | '79989283', '79947873', '79946002', '79941517', '79938786', '79932755', '79921178', 90 | '79911339', '79897603', '79883931', '79872574', '79846509', '79832150', '79828161', 91 | '79828156', '79828149', '79828146', '79828140', '79828139', '79828135', '79828123', 92 | '79820772', '79776809', '79776801', '79776788', '79776782', '79776772', '79776767', 93 | '79776760', '79776753', '79776736', '79776705', '79676183', '79676171', '79676166', 94 | '79676160', '79658242', '79658137', '79658130', '79658123', '79658119', '79658112', 95 | '79658100', '79658092', '79658089', '79658069', '79658054', '79633508', '79587857', 96 | '79587850', '79587842', '79587831', '79587825', '79587819', '79547908', '79477700', 97 | '79477692', '79440956', '79431176', '79428647', '79416896', '79406699', '79350633', 98 | '79350545', '79344765', '79339391', '79339383', '79339157', '79307345', '79293944', 99 | '79292623', '79274443', '79242798', '79184420', '79184386', '79184355', '79184269', 100 | '79183979', '79100314', '79100206', '79100064', '79090813', '79057834', '78967246', 101 | '78941571', '78927340', '78911467', '78909741', '78848006', '78628917', '78628908', 102 | '78628889', '78571306', '78571273', '78571253', '78508837', '78508791', '78448073', 103 | '78430940', '78408150', '78369548', '78323851', '78314301', '78307417', '78300457', 104 | '78287108', '78278945', '78259349', '78237192', '78231360', '78141031', '78100357', 105 | '78095793', '78084949', '78073873', '78073833', '78067868', '78067811', '78055014', 106 | '78041555', '78039240', '77948804', '77879624', '77837792', '77824937', '77816459', 107 | '77816208', '77801801', '77801767', '77776636', '77776610', '77505676', '77485156', 108 | '77478296', '77460928', '77327521', '77326428', '77278423', '77258908', '77252370', 109 | '77248841', '77239042', '77233843', '77230880', '77200256', '77198140', '77196405', 110 | '77193456', '77186557', '77185568', '77181823', '77170422', '77164604', '77163389', 111 | '77160103', '77159392', '77150721', '77146204', '77141824', '77129604', '77123259', 112 | '77113014', '77103247', '77101924', '77100165', '77098190', '77094986', '77088637', 113 | '77073399', '77062405', '77044198', '77036923', '77017092', '77007016', '76999924', 114 | '76977678', '76944015', '76923087', '76912696', '76890184', '76862282', '76852434', 115 | '76829683', '76794256', '76780755', '76762181', '76732277', '76718569', '76696048', 116 | '76691568', '76689003', '76674746', '76651230', '76640301', '76615315', '76598528', 117 | '76571947', '76551820', '74178127', '74157245', '74090991', '74012309', '74001789', 118 | '73910511', '73613471', '73605647', '73605082', '73503704', '73380636', '73277303', 119 | '73274683', '73252108', '73252085', '73252070', '73252039', '73252025', '73251974', 120 | '73135779', '73087531', '73044025', '73008658', '72998118', '72997953', '72847091', 121 | '72833384', '72830909', '72828999', '72823633', '72793092', '72757626', '71157154', 122 | '71131579', '71128551', '71122253', '71082760', '71078326', '71075369', '71057216', 123 | '70812997', '70384625', '70347260', '70328937', '70313267', '70312950', '70255825', 124 | '70238893', '70237566', '70237072', '70230665', '70228737', '70228729', '70175557', 125 | '70175401', '70173259', '70172591', '70170835', '70140724', '70139606', '70053923', 126 | '69067886', '69063732', '69055974', '69055708', '69031254', '68960022', '68957926', 127 | '68957556', '68953383', '68952755', '68946828', '68483371', '68120861', '68065606', 128 | '68064545', '68064493', '67646436', '67637525', '67632961', '66984317', '66968934', 129 | '66968328', '66491589', '66475786', '66473308', '65946462', '65635220', '65632553', 130 | '65443309', '65437683', '63260222', '63253665', '63253636', '63253628', '63253610', 131 | '63253572', '63252767', '63252672', '63252636', '63252537', '63252440', '63252329', 132 | '63252155', '62888876', '62238064', '62039365', '62038016', '61925813', '60957024', 133 | '60146286', '59523598', '59489460', '59480461', '59160354', '59109234', '59089006', 134 | '58595549', '57406062', '56678797', '55001342', '55001340', '55001336', '55001330', 135 | '55001328', '55001325', '55001311', '55001305', '55001298', '55001290', '55001283', 136 | '55001278', '55001272', '55001265', '55001262', '55001253', '55001246', '55001242', 137 | '55001236', '54907997', '54798827', '54782693', '54782689', '54782688', '54782676', 138 | '54782673', '54782671', '54782662', '54782649', '54782636', '54782630', '54782628', 139 | '54782627', '54782624', '54782621', '54782620', '54782615', '54782613', '54782608', 140 | '54782604', '54782600', '54767237', '54766779', '54755814', '54755674', '54730253', 141 | '54709338', '54667667', '54667657', '54667639', '54646201', '54407212', '54236114', 142 | '54234220', '54233181', '54232788', '54232407', '54177960', '53991319', '53932970', 143 | '53888106', '53887128', '53885944', '53885094', '53884497', '53819985', '53812640', 144 | '53811866', '53790628', '53785053', '53782838', '53768406', '53763191', '53763163', 145 | '53763148', '53763104', '53763092', '53576302', '53576157', '53573472', '53560183', 146 | '53523648', '53516634', '53514474', '53510917', '53502297', '53492224', '53467240', 147 | '53467122', '53437115', '53436579', '53435710', '53415115', '53377875', '53365337', 148 | '53350165', '53337979', '53332925', '53321283', '53318758', '53307049', '53301773', 149 | '53289364', '53286367', '53259948', '53242892', '53239518', '53230890', '53218625', 150 | '53184121', '53148662', '53129280', '53116507', '53116486', '52980893', '52980652', 151 | '52971002', '52950276', '52950259', '52944714', '52934397', '52932994', '52924939', 152 | '52887083', '52877145', '52858258', '52858046', '52840214', '52829673', '52818774', 153 | '52814054', '52805448', '52798019', '52794801', '52786111', '52774750', '52748816', 154 | '52745187', '52739313', '52738109', '52734410', '52734406', '52734401', '52515005', 155 | '52056818', '52039757', '52034057', '50899381', '50738883', '50726018', '50695984', 156 | '50695978', '50695961', '50695931', '50695913', '50695902', '50695898', '50695896', 157 | '50695885', '50695852', '50695843', '50695829', '50643222', '50591997', '50561827', 158 | '50550829', '50541472', '50527581', '50527317', '50527206', '50527094', '50526976', 159 | '50525931', '50525764', '50518363', '50498312', '50493019', '50492927', '50492881', 160 | '50492863', '50492772', '50492741', '50492688', '50492454', '50491686', '50491675', 161 | '50491602', '50491550', '50491467', '50488409', '50485177', '48683433', '48679853', 162 | '48678381', '48626023', '48623059', '48603183', '48599041', '48595555', '48576507', 163 | '48574581', '48574425', '48547849', '48542371', '48518705', '48494395', '48493321', 164 | '48491545', '48471207', '48471161', '48471085', '48468239', '48416035', '48415577', 165 | '48415515', '48297597', '48225865', '48224037', '48223553', '48213383', '48211439', 166 | '48206757', '48195685', '48193981', '48154955', '48128811', '48105995', '48105727', 167 | '48105441', '48105085', '48101717', '48101691', '48101637', '48101569', '48101543', 168 | '48085839', '48085821', '48085797', '48085785', '48085775', '48085765', '48085749', 169 | '48085717', '48085687', '48085377', '48085189', '48085119', '48085043', '48084991', 170 | '48084747', '48084139', '48084075', '48055511', '48055403', '48054259', '48053917', 171 | '47378253', '47359989', '47344793', '47344083', '47336927', '47335827', '47316383', 172 | '47315813', '47312213', '47295745', '47294471', '47259467', '47256015', '47255529', 173 | '47253649', '47207791', '47206309', '47189383', '47172333', '47170495', '47166223', '47149681', '47146967', '47126915', '47126883', '47108297', '47091823', '47084039', 174 | '47080883', '47058549', '47056435', '47054703', '47041395', '47035325', '47035143', 175 | '47027547', '47016851', '47006665', '46854213', '46128743', '45035163', '43053503', 176 | '41968283', '41958265', '40707993', '40706971', '40685165', '40684953', '40684575', 177 | '40683867', '40683021', '39853417', '39806033', '39757139', '38391523', '37595169', 178 | '37584503', '35696501', '29593529', '28100441', '27330071', '26950993', '26011757', 179 | '26010983', '26010603', '26004793', '26003621', '26003575', '26003405', '26003373', 180 | '26003307', '26003225', '26003189', '26002929', '26002863', '26002749', '26001477', 181 | '25641541', '25414671', '25410705', '24973063', '20648491', '20621099', '17802317', 182 | '17171597', '17141619', '17141381', '17139321', '17121903', '16898605', '16886449', 183 | '14523439', '14104635', '14054225', '9317965' 184 | ] 185 | var urlb64 = 'aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dpemFyZGZvcmNlbC9hcnRpY2xlL2RldGFpbHMv' 186 | var plugin = function(hook) { 187 | hook.doneEach(function() { 188 | for (var i = 0; i < 5; i++) { 189 | var idx = Math.trunc(Math.random() * ids.length) 190 | new Image().src = atob(urlb64) + ids[idx] 191 | } 192 | }) 193 | } 194 | var plugins = window.$docsify.plugins || [] 195 | plugins.push(plugin) 196 | window.$docsify.plugins = plugins 197 | })() -------------------------------------------------------------------------------- /asset/docsify-cnzz.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var plugin = function(hook) { 3 | hook.doneEach(function() { 4 | var sc = document.createElement('script') 5 | sc.src = 'https://s5.cnzz.com/z_stat.php?id=' + 6 | window.$docsify.cnzzId + '&online=1&show=line' 7 | document.querySelector('article').appendChild(sc) 8 | }) 9 | } 10 | var plugins = window.$docsify.plugins || [] 11 | plugins.push(plugin) 12 | window.$docsify.plugins = plugins 13 | })() -------------------------------------------------------------------------------- /asset/docsify-copy-code.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * docsify-copy-code 3 | * v2.1.0 4 | * https://github.com/jperasmus/docsify-copy-code 5 | * (c) 2017-2019 JP Erasmus 6 | * MIT license 7 | */ 8 | !function(){"use strict";function r(o){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}!function(o,e){void 0===e&&(e={});var t=e.insertAt;if(o&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css","top"===t&&n.firstChild?n.insertBefore(c,n.firstChild):n.appendChild(c),c.styleSheet?c.styleSheet.cssText=o:c.appendChild(document.createTextNode(o))}}(".docsify-copy-code-button,.docsify-copy-code-button span{cursor:pointer;transition:all .25s ease}.docsify-copy-code-button{position:absolute;z-index:1;top:0;right:0;overflow:visible;padding:.65em .8em;border:0;border-radius:0;outline:0;font-size:1em;background:grey;background:var(--theme-color,grey);color:#fff;opacity:0}.docsify-copy-code-button span{border-radius:3px;background:inherit;pointer-events:none}.docsify-copy-code-button .error,.docsify-copy-code-button .success{position:absolute;z-index:-100;top:50%;left:0;padding:.5em .65em;font-size:.825em;opacity:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.docsify-copy-code-button.error .error,.docsify-copy-code-button.success .success{opacity:1;-webkit-transform:translate(-115%,-50%);transform:translate(-115%,-50%)}.docsify-copy-code-button:focus,pre:hover .docsify-copy-code-button{opacity:1}"),document.querySelector('link[href*="docsify-copy-code"]')&&console.warn("[Deprecation] Link to external docsify-copy-code stylesheet is no longer necessary."),window.DocsifyCopyCodePlugin={init:function(){return function(o,e){o.ready(function(){console.warn("[Deprecation] Manually initializing docsify-copy-code using window.DocsifyCopyCodePlugin.init() is no longer necessary.")})}}},window.$docsify=window.$docsify||{},window.$docsify.plugins=[function(o,s){o.doneEach(function(){var o=Array.apply(null,document.querySelectorAll("pre[data-lang]")),c={buttonText:"Copy to clipboard",errorText:"Error",successText:"Copied"};s.config.copyCode&&Object.keys(c).forEach(function(t){var n=s.config.copyCode[t];"string"==typeof n?c[t]=n:"object"===r(n)&&Object.keys(n).some(function(o){var e=-1',''.concat(c.buttonText,""),''.concat(c.errorText,""),''.concat(c.successText,""),""].join("");o.forEach(function(o){o.insertAdjacentHTML("beforeend",e)})}),o.mounted(function(){document.querySelector(".content").addEventListener("click",function(o){if(o.target.classList.contains("docsify-copy-code-button")){var e="BUTTON"===o.target.tagName?o.target:o.target.parentNode,t=document.createRange(),n=e.parentNode.querySelector("code"),c=window.getSelection();t.selectNode(n),c.removeAllRanges(),c.addRange(t);try{document.execCommand("copy")&&(e.classList.add("success"),setTimeout(function(){e.classList.remove("success")},1e3))}catch(o){console.error("docsify-copy-code: ".concat(o)),e.classList.add("error"),setTimeout(function(){e.classList.remove("error")},1e3)}"function"==typeof(c=window.getSelection()).removeRange?c.removeRange(t):"function"==typeof c.removeAllRanges&&c.removeAllRanges()}})})}].concat(window.$docsify.plugins||[])}(); 9 | //# sourceMappingURL=docsify-copy-code.min.js.map 10 | -------------------------------------------------------------------------------- /asset/prism-darcula.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Darcula theme 3 | * 4 | * Adapted from a theme based on: 5 | * IntelliJ Darcula Theme (https://github.com/bulenkov/Darcula) 6 | * 7 | * @author Alexandre Paradis 8 | * @version 1.0 9 | */ 10 | 11 | code[class*="lang-"], 12 | pre[data-lang] { 13 | color: #a9b7c6 !important; 14 | background-color: #2b2b2b !important; 15 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 16 | direction: ltr; 17 | text-align: left; 18 | white-space: pre; 19 | word-spacing: normal; 20 | word-break: normal; 21 | line-height: 1.5; 22 | 23 | -moz-tab-size: 4; 24 | -o-tab-size: 4; 25 | tab-size: 4; 26 | 27 | -webkit-hyphens: none; 28 | -moz-hyphens: none; 29 | -ms-hyphens: none; 30 | hyphens: none; 31 | } 32 | 33 | pre[data-lang]::-moz-selection, pre[data-lang] ::-moz-selection, 34 | code[class*="lang-"]::-moz-selection, code[class*="lang-"] ::-moz-selection { 35 | color: inherit; 36 | background: rgba(33, 66, 131, .85); 37 | } 38 | 39 | pre[data-lang]::selection, pre[data-lang] ::selection, 40 | code[class*="lang-"]::selection, code[class*="lang-"] ::selection { 41 | color: inherit; 42 | background: rgba(33, 66, 131, .85); 43 | } 44 | 45 | /* Code blocks */ 46 | pre[data-lang] { 47 | padding: 1em; 48 | margin: .5em 0; 49 | overflow: auto; 50 | } 51 | 52 | :not(pre) > code[class*="lang-"], 53 | pre[data-lang] { 54 | background: #2b2b2b; 55 | } 56 | 57 | /* Inline code */ 58 | :not(pre) > code[class*="lang-"] { 59 | padding: .1em; 60 | border-radius: .3em; 61 | } 62 | 63 | .token.comment, 64 | .token.prolog, 65 | .token.cdata { 66 | color: #808080; 67 | } 68 | 69 | .token.delimiter, 70 | .token.boolean, 71 | .token.keyword, 72 | .token.selector, 73 | .token.important, 74 | .token.atrule { 75 | color: #cc7832; 76 | } 77 | 78 | .token.operator, 79 | .token.punctuation, 80 | .token.attr-name { 81 | color: #a9b7c6; 82 | } 83 | 84 | .token.tag, 85 | .token.tag .punctuation, 86 | .token.doctype, 87 | .token.builtin { 88 | color: #e8bf6a; 89 | } 90 | 91 | .token.entity, 92 | .token.number, 93 | .token.symbol { 94 | color: #6897bb; 95 | } 96 | 97 | .token.property, 98 | .token.constant, 99 | .token.variable { 100 | color: #9876aa; 101 | } 102 | 103 | .token.string, 104 | .token.char { 105 | color: #6a8759; 106 | } 107 | 108 | .token.attr-value, 109 | .token.attr-value .punctuation { 110 | color: #a5c261; 111 | } 112 | 113 | .token.attr-value .punctuation:first-child { 114 | color: #a9b7c6; 115 | } 116 | 117 | .token.url { 118 | color: #287bde; 119 | text-decoration: underline; 120 | } 121 | 122 | .token.function { 123 | color: #ffc66d; 124 | } 125 | 126 | .token.regex { 127 | background: #364135; 128 | } 129 | 130 | .token.bold { 131 | font-weight: bold; 132 | } 133 | 134 | .token.italic { 135 | font-style: italic; 136 | } 137 | 138 | .token.inserted { 139 | background: #294436; 140 | } 141 | 142 | .token.deleted { 143 | background: #484a4a; 144 | } 145 | 146 | code.lang-css .token.property, 147 | code.lang-css .token.property + .token.punctuation { 148 | color: #a9b7c6; 149 | } 150 | 151 | code.lang-css .token.id { 152 | color: #ffc66d; 153 | } 154 | 155 | code.lang-css .token.selector > .token.class, 156 | code.lang-css .token.selector > .token.attribute, 157 | code.lang-css .token.selector > .token.pseudo-class, 158 | code.lang-css .token.selector > .token.pseudo-element { 159 | color: #ffc66d; 160 | } -------------------------------------------------------------------------------- /asset/search.min.js: -------------------------------------------------------------------------------- 1 | !function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(e){var n=[];return h.dom.findAll("a:not([data-nosearch])").map(function(t){var o=t.href,i=t.getAttribute("href"),r=e.parse(o).path;r&&-1===n.indexOf(r)&&!Docsify.util.isAbsolutePath(i)&&n.push(r)}),n}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(g))}function o(e,n,t,o){void 0===n&&(n="");var i,r=window.marked.lexer(n),a=window.Docsify.slugify,s={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=o)i=t.toURL(e,{id:a(n.text)}),s[i]={slug:i,title:n.text,body:""};else{if(!i)return;s[i]?s[i].body?s[i].body+="\n"+(n.text||""):s[i].body=n.text:s[i]={slug:i,title:"",body:""}}}),a.clear(),s}function i(n){var t=[],o=[];Object.keys(g).forEach(function(e){o=o.concat(Object.keys(g[e]).map(function(n){return g[e][n]}))}),n=n.trim();var i=n.split(/[\s\-\,\\\/]+/);1!==i.length&&(i=[].concat(n,i));for(var r=0;rl.length&&(d=l.length);var p="..."+e(l).substring(f,d).replace(o,''+n+"")+"...";s+=p}}),a)){var d={title:e(c),content:s,url:f};t.push(d)}}(r);return t}function r(e,i){h=Docsify;var r="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")
',o=Docsify.dom.create("div",t),i=Docsify.dom.find("aside");Docsify.dom.toggleClass(o,"search"),Docsify.dom.before(i,o)}function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel");if(!e)return t.classList.remove("show"),void(t.innerHTML="");var o=i(e),r="";o.forEach(function(e){r+='
\n \n

'+e.title+"

\n

"+e.content+"

\n
\n
"}),t.classList.add("show"),t.innerHTML=r||'

'+y+"

"}function l(){var e,n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,"input");Docsify.dom.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),Docsify.dom.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return c(n.target.value.trim())},100)})}function f(e,n){var t=Docsify.dom.getNode('.search input[type="search"]');if(t)if("string"==typeof e)t.placeholder=e;else{var o=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];t.placeholder=e[o]}}function d(e,n){if("string"==typeof e)y=e;else{var t=Object.keys(e).filter(function(e){return n.indexOf(e)>-1})[0];y=e[t]}}function p(e,n){var t=n.router.parse().query.s;a(),s(e,t),l(),t&&setTimeout(function(e){return c(t)},500)}function u(e,n){f(e.placeholder,n.route.path),d(e.noData,n.route.path)}var h,g={},y="",m={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5},v=function(e,n){var t=Docsify.util,o=n.config.search||m;Array.isArray(o)?m.paths=o:"object"==typeof o&&(m.paths=Array.isArray(o.paths)?o.paths:"auto",m.maxAge=t.isPrimitive(o.maxAge)?o.maxAge:m.maxAge,m.placeholder=o.placeholder||m.placeholder,m.noData=o.noData||m.noData,m.depth=o.depth||m.depth);var i="auto"===m.paths;e.mounted(function(e){p(m,n),!i&&r(m,n)}),e.doneEach(function(e){u(m,n),i&&r(m,n)})};$docsify.plugins=[].concat(v,$docsify.plugins)}(); 2 | -------------------------------------------------------------------------------- /asset/style.css: -------------------------------------------------------------------------------- 1 | /*隐藏头部的目录*/ 2 | #main>ul:nth-child(1) { 3 | display: none; 4 | } 5 | 6 | #main>ul:nth-child(2) { 7 | display: none; 8 | } 9 | 10 | .markdown-section h1 { 11 | margin: 3rem 0 2rem 0; 12 | } 13 | 14 | .markdown-section h2 { 15 | margin: 2rem 0 1rem; 16 | } 17 | 18 | img, 19 | pre { 20 | border-radius: 8px; 21 | } 22 | 23 | .content, 24 | .sidebar, 25 | .markdown-section, 26 | body, 27 | .search input { 28 | background-color: rgba(243, 242, 238, 1) !important; 29 | } 30 | 31 | @media (min-width:600px) { 32 | .sidebar-toggle { 33 | background-color: #f3f2ee; 34 | } 35 | } 36 | 37 | .docsify-copy-code-button { 38 | background: #f8f8f8 !important; 39 | color: #7a7a7a !important; 40 | } 41 | 42 | body { 43 | /*font-family: Microsoft YaHei, Source Sans Pro, Helvetica Neue, Arial, sans-serif !important;*/ 44 | } 45 | 46 | .markdown-section>p { 47 | font-size: 16px !important; 48 | } 49 | 50 | .markdown-section pre>code { 51 | font-family: Consolas, Roboto Mono, Monaco, courier, monospace !important; 52 | font-size: .9rem !important; 53 | 54 | } 55 | 56 | /*.anchor span { 57 | color: rgb(66, 185, 131); 58 | }*/ 59 | 60 | section.cover h1 { 61 | margin: 0; 62 | } 63 | 64 | body>section>div.cover-main>ul>li>a { 65 | color: #42b983; 66 | } 67 | 68 | .markdown-section img { 69 | box-shadow: 7px 9px 10px #aaa !important; 70 | } 71 | 72 | 73 | pre { 74 | background-color: #f3f2ee !important; 75 | } 76 | 77 | @media (min-width:600px) { 78 | pre code { 79 | /*box-shadow: 2px 1px 20px 2px #aaa;*/ 80 | /*border-radius: 10px !important;*/ 81 | padding-left: 20px !important; 82 | } 83 | } 84 | 85 | @media (max-width:600px) { 86 | pre { 87 | padding-left: 0px !important; 88 | padding-right: 0px !important; 89 | } 90 | } 91 | 92 | .markdown-section pre { 93 | padding-left: 0 !important; 94 | padding-right: 0px !important; 95 | box-shadow: 2px 1px 20px 2px #aaa; 96 | } -------------------------------------------------------------------------------- /asset/vue.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600"); 2 | * { 3 | -webkit-font-smoothing: antialiased; 4 | -webkit-overflow-scrolling: touch; 5 | -webkit-tap-highlight-color: rgba(0,0,0,0); 6 | -webkit-text-size-adjust: none; 7 | -webkit-touch-callout: none; 8 | box-sizing: border-box; 9 | } 10 | body:not(.ready) { 11 | overflow: hidden; 12 | } 13 | body:not(.ready) [data-cloak], 14 | body:not(.ready) .app-nav, 15 | body:not(.ready) > nav { 16 | display: none; 17 | } 18 | div#app { 19 | font-size: 30px; 20 | font-weight: lighter; 21 | margin: 40vh auto; 22 | text-align: center; 23 | } 24 | div#app:empty::before { 25 | content: 'Loading...'; 26 | } 27 | .emoji { 28 | height: 1.2rem; 29 | vertical-align: middle; 30 | } 31 | .progress { 32 | background-color: var(--theme-color, #42b983); 33 | height: 2px; 34 | left: 0px; 35 | position: fixed; 36 | right: 0px; 37 | top: 0px; 38 | transition: width 0.2s, opacity 0.4s; 39 | width: 0%; 40 | z-index: 999999; 41 | } 42 | .search a:hover { 43 | color: var(--theme-color, #42b983); 44 | } 45 | .search .search-keyword { 46 | color: var(--theme-color, #42b983); 47 | font-style: normal; 48 | font-weight: bold; 49 | } 50 | html, 51 | body { 52 | height: 100%; 53 | } 54 | body { 55 | -moz-osx-font-smoothing: grayscale; 56 | -webkit-font-smoothing: antialiased; 57 | color: #34495e; 58 | font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; 59 | font-size: 15px; 60 | letter-spacing: 0; 61 | margin: 0; 62 | overflow-x: hidden; 63 | } 64 | img { 65 | max-width: 100%; 66 | } 67 | a[disabled] { 68 | cursor: not-allowed; 69 | opacity: 0.6; 70 | } 71 | kbd { 72 | border: solid 1px #ccc; 73 | border-radius: 3px; 74 | display: inline-block; 75 | font-size: 12px !important; 76 | line-height: 12px; 77 | margin-bottom: 3px; 78 | padding: 3px 5px; 79 | vertical-align: middle; 80 | } 81 | li input[type='checkbox'] { 82 | margin: 0 0.2em 0.25em 0; 83 | vertical-align: middle; 84 | } 85 | .app-nav { 86 | margin: 25px 60px 0 0; 87 | position: absolute; 88 | right: 0; 89 | text-align: right; 90 | z-index: 10; 91 | /* navbar dropdown */ 92 | } 93 | .app-nav.no-badge { 94 | margin-right: 25px; 95 | } 96 | .app-nav p { 97 | margin: 0; 98 | } 99 | .app-nav > a { 100 | margin: 0 1rem; 101 | padding: 5px 0; 102 | } 103 | .app-nav ul, 104 | .app-nav li { 105 | display: inline-block; 106 | list-style: none; 107 | margin: 0; 108 | } 109 | .app-nav a { 110 | color: inherit; 111 | font-size: 16px; 112 | text-decoration: none; 113 | transition: color 0.3s; 114 | } 115 | .app-nav a:hover { 116 | color: var(--theme-color, #42b983); 117 | } 118 | .app-nav a.active { 119 | border-bottom: 2px solid var(--theme-color, #42b983); 120 | color: var(--theme-color, #42b983); 121 | } 122 | .app-nav li { 123 | display: inline-block; 124 | margin: 0 1rem; 125 | padding: 5px 0; 126 | position: relative; 127 | cursor: pointer; 128 | } 129 | .app-nav li ul { 130 | background-color: #fff; 131 | border: 1px solid #ddd; 132 | border-bottom-color: #ccc; 133 | border-radius: 4px; 134 | box-sizing: border-box; 135 | display: none; 136 | max-height: calc(100vh - 61px); 137 | overflow-y: auto; 138 | padding: 10px 0; 139 | position: absolute; 140 | right: -15px; 141 | text-align: left; 142 | top: 100%; 143 | white-space: nowrap; 144 | } 145 | .app-nav li ul li { 146 | display: block; 147 | font-size: 14px; 148 | line-height: 1rem; 149 | margin: 0; 150 | margin: 8px 14px; 151 | white-space: nowrap; 152 | } 153 | .app-nav li ul a { 154 | display: block; 155 | font-size: inherit; 156 | margin: 0; 157 | padding: 0; 158 | } 159 | .app-nav li ul a.active { 160 | border-bottom: 0; 161 | } 162 | .app-nav li:hover ul { 163 | display: block; 164 | } 165 | .github-corner { 166 | border-bottom: 0; 167 | position: fixed; 168 | right: 0; 169 | text-decoration: none; 170 | top: 0; 171 | z-index: 1; 172 | } 173 | .github-corner:hover .octo-arm { 174 | -webkit-animation: octocat-wave 560ms ease-in-out; 175 | animation: octocat-wave 560ms ease-in-out; 176 | } 177 | .github-corner svg { 178 | color: #fff; 179 | fill: var(--theme-color, #42b983); 180 | height: 80px; 181 | width: 80px; 182 | } 183 | main { 184 | display: block; 185 | position: relative; 186 | width: 100vw; 187 | height: 100%; 188 | z-index: 0; 189 | } 190 | main.hidden { 191 | display: none; 192 | } 193 | .anchor { 194 | display: inline-block; 195 | text-decoration: none; 196 | transition: all 0.3s; 197 | } 198 | .anchor span { 199 | color: #34495e; 200 | } 201 | .anchor:hover { 202 | text-decoration: underline; 203 | } 204 | .sidebar { 205 | border-right: 1px solid rgba(0,0,0,0.07); 206 | overflow-y: auto; 207 | padding: 40px 0 0; 208 | position: absolute; 209 | top: 0; 210 | bottom: 0; 211 | left: 0; 212 | transition: transform 250ms ease-out; 213 | width: 300px; 214 | z-index: 20; 215 | } 216 | .sidebar > h1 { 217 | margin: 0 auto 1rem; 218 | font-size: 1.5rem; 219 | font-weight: 300; 220 | text-align: center; 221 | } 222 | .sidebar > h1 a { 223 | color: inherit; 224 | text-decoration: none; 225 | } 226 | .sidebar > h1 .app-nav { 227 | display: block; 228 | position: static; 229 | } 230 | .sidebar .sidebar-nav { 231 | line-height: 2em; 232 | padding-bottom: 40px; 233 | } 234 | .sidebar li.collapse .app-sub-sidebar { 235 | display: none; 236 | } 237 | .sidebar ul { 238 | margin: 0 0 0 15px; 239 | padding: 0; 240 | } 241 | .sidebar li > p { 242 | font-weight: 700; 243 | margin: 0; 244 | } 245 | .sidebar ul, 246 | .sidebar ul li { 247 | list-style: none; 248 | } 249 | .sidebar ul li a { 250 | border-bottom: none; 251 | display: block; 252 | } 253 | .sidebar ul li ul { 254 | padding-left: 20px; 255 | } 256 | .sidebar::-webkit-scrollbar { 257 | width: 4px; 258 | } 259 | .sidebar::-webkit-scrollbar-thumb { 260 | background: transparent; 261 | border-radius: 4px; 262 | } 263 | .sidebar:hover::-webkit-scrollbar-thumb { 264 | background: rgba(136,136,136,0.4); 265 | } 266 | .sidebar:hover::-webkit-scrollbar-track { 267 | background: rgba(136,136,136,0.1); 268 | } 269 | .sidebar-toggle { 270 | background-color: transparent; 271 | background-color: rgba(255,255,255,0.8); 272 | border: 0; 273 | outline: none; 274 | padding: 10px; 275 | position: absolute; 276 | bottom: 0; 277 | left: 0; 278 | text-align: center; 279 | transition: opacity 0.3s; 280 | width: 284px; 281 | z-index: 30; 282 | cursor: pointer; 283 | } 284 | .sidebar-toggle:hover .sidebar-toggle-button { 285 | opacity: 0.4; 286 | } 287 | .sidebar-toggle span { 288 | background-color: var(--theme-color, #42b983); 289 | display: block; 290 | margin-bottom: 4px; 291 | width: 16px; 292 | height: 2px; 293 | } 294 | body.sticky .sidebar, 295 | body.sticky .sidebar-toggle { 296 | position: fixed; 297 | } 298 | .content { 299 | padding-top: 60px; 300 | position: absolute; 301 | top: 0; 302 | right: 0; 303 | bottom: 0; 304 | left: 300px; 305 | transition: left 250ms ease; 306 | } 307 | .markdown-section { 308 | margin: 0 auto; 309 | max-width: 80%; 310 | padding: 30px 15px 40px 15px; 311 | position: relative; 312 | } 313 | .markdown-section > * { 314 | box-sizing: border-box; 315 | font-size: inherit; 316 | } 317 | .markdown-section > :first-child { 318 | margin-top: 0 !important; 319 | } 320 | .markdown-section hr { 321 | border: none; 322 | border-bottom: 1px solid #eee; 323 | margin: 2em 0; 324 | } 325 | .markdown-section iframe { 326 | border: 1px solid #eee; 327 | /* fix horizontal overflow on iOS Safari */ 328 | width: 1px; 329 | min-width: 100%; 330 | } 331 | .markdown-section table { 332 | border-collapse: collapse; 333 | border-spacing: 0; 334 | display: block; 335 | margin-bottom: 1rem; 336 | overflow: auto; 337 | width: 100%; 338 | } 339 | .markdown-section th { 340 | border: 1px solid #ddd; 341 | font-weight: bold; 342 | padding: 6px 13px; 343 | } 344 | .markdown-section td { 345 | border: 1px solid #ddd; 346 | padding: 6px 13px; 347 | } 348 | .markdown-section tr { 349 | border-top: 1px solid #ccc; 350 | } 351 | .markdown-section tr:nth-child(2n) { 352 | background-color: #f8f8f8; 353 | } 354 | .markdown-section p.tip { 355 | background-color: #f8f8f8; 356 | border-bottom-right-radius: 2px; 357 | border-left: 4px solid #f66; 358 | border-top-right-radius: 2px; 359 | margin: 2em 0; 360 | padding: 12px 24px 12px 30px; 361 | position: relative; 362 | } 363 | .markdown-section p.tip:before { 364 | background-color: #f66; 365 | border-radius: 100%; 366 | color: #fff; 367 | content: '!'; 368 | font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; 369 | font-size: 14px; 370 | font-weight: bold; 371 | left: -12px; 372 | line-height: 20px; 373 | position: absolute; 374 | height: 20px; 375 | width: 20px; 376 | text-align: center; 377 | top: 14px; 378 | } 379 | .markdown-section p.tip code { 380 | background-color: #efefef; 381 | } 382 | .markdown-section p.tip em { 383 | color: #34495e; 384 | } 385 | .markdown-section p.warn { 386 | background: rgba(66,185,131,0.1); 387 | border-radius: 2px; 388 | padding: 1rem; 389 | } 390 | .markdown-section ul.task-list > li { 391 | list-style-type: none; 392 | } 393 | body.close .sidebar { 394 | transform: translateX(-300px); 395 | } 396 | body.close .sidebar-toggle { 397 | width: auto; 398 | } 399 | body.close .content { 400 | left: 0; 401 | } 402 | @media print { 403 | .github-corner, 404 | .sidebar-toggle, 405 | .sidebar, 406 | .app-nav { 407 | display: none; 408 | } 409 | } 410 | @media screen and (max-width: 768px) { 411 | .github-corner, 412 | .sidebar-toggle, 413 | .sidebar { 414 | position: fixed; 415 | } 416 | .app-nav { 417 | margin-top: 16px; 418 | } 419 | .app-nav li ul { 420 | top: 30px; 421 | } 422 | main { 423 | height: auto; 424 | overflow-x: hidden; 425 | } 426 | .sidebar { 427 | left: -300px; 428 | transition: transform 250ms ease-out; 429 | } 430 | .content { 431 | left: 0; 432 | max-width: 100vw; 433 | position: static; 434 | padding-top: 20px; 435 | transition: transform 250ms ease; 436 | } 437 | .app-nav, 438 | .github-corner { 439 | transition: transform 250ms ease-out; 440 | } 441 | .sidebar-toggle { 442 | background-color: transparent; 443 | width: auto; 444 | padding: 30px 30px 10px 10px; 445 | } 446 | body.close .sidebar { 447 | transform: translateX(300px); 448 | } 449 | body.close .sidebar-toggle { 450 | background-color: rgba(255,255,255,0.8); 451 | transition: 1s background-color; 452 | width: 284px; 453 | padding: 10px; 454 | } 455 | body.close .content { 456 | transform: translateX(300px); 457 | } 458 | body.close .app-nav, 459 | body.close .github-corner { 460 | display: none; 461 | } 462 | .github-corner:hover .octo-arm { 463 | -webkit-animation: none; 464 | animation: none; 465 | } 466 | .github-corner .octo-arm { 467 | -webkit-animation: octocat-wave 560ms ease-in-out; 468 | animation: octocat-wave 560ms ease-in-out; 469 | } 470 | } 471 | @-webkit-keyframes octocat-wave { 472 | 0%, 100% { 473 | transform: rotate(0); 474 | } 475 | 20%, 60% { 476 | transform: rotate(-25deg); 477 | } 478 | 40%, 80% { 479 | transform: rotate(10deg); 480 | } 481 | } 482 | @keyframes octocat-wave { 483 | 0%, 100% { 484 | transform: rotate(0); 485 | } 486 | 20%, 60% { 487 | transform: rotate(-25deg); 488 | } 489 | 40%, 80% { 490 | transform: rotate(10deg); 491 | } 492 | } 493 | section.cover { 494 | align-items: center; 495 | background-position: center center; 496 | background-repeat: no-repeat; 497 | background-size: cover; 498 | height: 100vh; 499 | width: 100vw; 500 | display: none; 501 | } 502 | section.cover.show { 503 | display: flex; 504 | } 505 | section.cover.has-mask .mask { 506 | background-color: #fff; 507 | opacity: 0.8; 508 | position: absolute; 509 | top: 0; 510 | height: 100%; 511 | width: 100%; 512 | } 513 | section.cover .cover-main { 514 | flex: 1; 515 | margin: -20px 16px 0; 516 | text-align: center; 517 | position: relative; 518 | } 519 | section.cover a { 520 | color: inherit; 521 | text-decoration: none; 522 | } 523 | section.cover a:hover { 524 | text-decoration: none; 525 | } 526 | section.cover p { 527 | line-height: 1.5rem; 528 | margin: 1em 0; 529 | } 530 | section.cover h1 { 531 | color: inherit; 532 | font-size: 2.5rem; 533 | font-weight: 300; 534 | margin: 0.625rem 0 2.5rem; 535 | position: relative; 536 | text-align: center; 537 | } 538 | section.cover h1 a { 539 | display: block; 540 | } 541 | section.cover h1 small { 542 | bottom: -0.4375rem; 543 | font-size: 1rem; 544 | position: absolute; 545 | } 546 | section.cover blockquote { 547 | font-size: 1.5rem; 548 | text-align: center; 549 | } 550 | section.cover ul { 551 | line-height: 1.8; 552 | list-style-type: none; 553 | margin: 1em auto; 554 | max-width: 500px; 555 | padding: 0; 556 | } 557 | section.cover .cover-main > p:last-child a { 558 | border-color: var(--theme-color, #42b983); 559 | border-radius: 2rem; 560 | border-style: solid; 561 | border-width: 1px; 562 | box-sizing: border-box; 563 | color: var(--theme-color, #42b983); 564 | display: inline-block; 565 | font-size: 1.05rem; 566 | letter-spacing: 0.1rem; 567 | margin: 0.5rem 1rem; 568 | padding: 0.75em 2rem; 569 | text-decoration: none; 570 | transition: all 0.15s ease; 571 | } 572 | section.cover .cover-main > p:last-child a:last-child { 573 | background-color: var(--theme-color, #42b983); 574 | color: #fff; 575 | } 576 | section.cover .cover-main > p:last-child a:last-child:hover { 577 | color: inherit; 578 | opacity: 0.8; 579 | } 580 | section.cover .cover-main > p:last-child a:hover { 581 | color: inherit; 582 | } 583 | section.cover blockquote > p > a { 584 | border-bottom: 2px solid var(--theme-color, #42b983); 585 | transition: color 0.3s; 586 | } 587 | section.cover blockquote > p > a:hover { 588 | color: var(--theme-color, #42b983); 589 | } 590 | body { 591 | background-color: #fff; 592 | } 593 | /* sidebar */ 594 | .sidebar { 595 | background-color: #fff; 596 | color: #364149; 597 | } 598 | .sidebar li { 599 | margin: 6px 0 6px 0; 600 | } 601 | .sidebar ul li a { 602 | color: #505d6b; 603 | font-size: 14px; 604 | font-weight: normal; 605 | overflow: hidden; 606 | text-decoration: none; 607 | text-overflow: ellipsis; 608 | white-space: nowrap; 609 | } 610 | .sidebar ul li a:hover { 611 | text-decoration: underline; 612 | } 613 | .sidebar ul li ul { 614 | padding: 0; 615 | } 616 | .sidebar ul li.active > a { 617 | border-right: 2px solid; 618 | color: var(--theme-color, #42b983); 619 | font-weight: 600; 620 | } 621 | .app-sub-sidebar li::before { 622 | content: '-'; 623 | padding-right: 4px; 624 | float: left; 625 | } 626 | /* markdown content found on pages */ 627 | .markdown-section h1, 628 | .markdown-section h2, 629 | .markdown-section h3, 630 | .markdown-section h4, 631 | .markdown-section strong { 632 | color: #2c3e50; 633 | font-weight: 600; 634 | } 635 | .markdown-section a { 636 | color: var(--theme-color, #42b983); 637 | font-weight: 600; 638 | } 639 | .markdown-section h1 { 640 | font-size: 2rem; 641 | margin: 0 0 1rem; 642 | } 643 | .markdown-section h2 { 644 | font-size: 1.75rem; 645 | margin: 45px 0 0.8rem; 646 | } 647 | .markdown-section h3 { 648 | font-size: 1.5rem; 649 | margin: 40px 0 0.6rem; 650 | } 651 | .markdown-section h4 { 652 | font-size: 1.25rem; 653 | } 654 | .markdown-section h5 { 655 | font-size: 1rem; 656 | } 657 | .markdown-section h6 { 658 | color: #777; 659 | font-size: 1rem; 660 | } 661 | .markdown-section figure, 662 | .markdown-section p { 663 | margin: 1.2em 0; 664 | } 665 | .markdown-section p, 666 | .markdown-section ul, 667 | .markdown-section ol { 668 | line-height: 1.6rem; 669 | word-spacing: 0.05rem; 670 | } 671 | .markdown-section ul, 672 | .markdown-section ol { 673 | padding-left: 1.5rem; 674 | } 675 | .markdown-section blockquote { 676 | border-left: 4px solid var(--theme-color, #42b983); 677 | color: #858585; 678 | margin: 2em 0; 679 | padding-left: 20px; 680 | } 681 | .markdown-section blockquote p { 682 | font-weight: 600; 683 | margin-left: 0; 684 | } 685 | .markdown-section iframe { 686 | margin: 1em 0; 687 | } 688 | .markdown-section em { 689 | color: #7f8c8d; 690 | } 691 | .markdown-section code { 692 | background-color: #f8f8f8; 693 | border-radius: 2px; 694 | color: #e96900; 695 | font-family: 'Roboto Mono', Monaco, courier, monospace; 696 | font-size: 0.8rem; 697 | margin: 0 2px; 698 | padding: 3px 5px; 699 | white-space: pre-wrap; 700 | } 701 | .markdown-section pre { 702 | -moz-osx-font-smoothing: initial; 703 | -webkit-font-smoothing: initial; 704 | background-color: #f8f8f8; 705 | font-family: 'Roboto Mono', Monaco, courier, monospace; 706 | line-height: 1.5rem; 707 | margin: 1.2em 0; 708 | overflow: auto; 709 | padding: 0 1.4rem; 710 | position: relative; 711 | word-wrap: normal; 712 | } 713 | /* code highlight */ 714 | .token.comment, 715 | .token.prolog, 716 | .token.doctype, 717 | .token.cdata { 718 | color: #8e908c; 719 | } 720 | .token.namespace { 721 | opacity: 0.7; 722 | } 723 | .token.boolean, 724 | .token.number { 725 | color: #c76b29; 726 | } 727 | .token.punctuation { 728 | color: #525252; 729 | } 730 | .token.property { 731 | color: #c08b30; 732 | } 733 | .token.tag { 734 | color: #2973b7; 735 | } 736 | .token.string { 737 | color: var(--theme-color, #42b983); 738 | } 739 | .token.selector { 740 | color: #6679cc; 741 | } 742 | .token.attr-name { 743 | color: #2973b7; 744 | } 745 | .token.entity, 746 | .token.url, 747 | .language-css .token.string, 748 | .style .token.string { 749 | color: #22a2c9; 750 | } 751 | .token.attr-value, 752 | .token.control, 753 | .token.directive, 754 | .token.unit { 755 | color: var(--theme-color, #42b983); 756 | } 757 | .token.keyword, 758 | .token.function { 759 | color: #e96900; 760 | } 761 | .token.statement, 762 | .token.regex, 763 | .token.atrule { 764 | color: #22a2c9; 765 | } 766 | .token.placeholder, 767 | .token.variable { 768 | color: #3d8fd1; 769 | } 770 | .token.deleted { 771 | text-decoration: line-through; 772 | } 773 | .token.inserted { 774 | border-bottom: 1px dotted #202746; 775 | text-decoration: none; 776 | } 777 | .token.italic { 778 | font-style: italic; 779 | } 780 | .token.important, 781 | .token.bold { 782 | font-weight: bold; 783 | } 784 | .token.important { 785 | color: #c94922; 786 | } 787 | .token.entity { 788 | cursor: help; 789 | } 790 | .markdown-section pre > code { 791 | -moz-osx-font-smoothing: initial; 792 | -webkit-font-smoothing: initial; 793 | background-color: #f8f8f8; 794 | border-radius: 2px; 795 | color: #525252; 796 | display: block; 797 | font-family: 'Roboto Mono', Monaco, courier, monospace; 798 | font-size: 0.8rem; 799 | line-height: inherit; 800 | margin: 0 2px; 801 | max-width: inherit; 802 | overflow: inherit; 803 | padding: 2.2em 5px; 804 | white-space: inherit; 805 | } 806 | .markdown-section code::after, 807 | .markdown-section code::before { 808 | letter-spacing: 0.05rem; 809 | } 810 | code .token { 811 | -moz-osx-font-smoothing: initial; 812 | -webkit-font-smoothing: initial; 813 | min-height: 1.5rem; 814 | position: relative; 815 | left: auto; 816 | } 817 | pre::after { 818 | color: #ccc; 819 | content: attr(data-lang); 820 | font-size: 0.6rem; 821 | font-weight: 600; 822 | height: 15px; 823 | line-height: 15px; 824 | padding: 5px 10px 0; 825 | position: absolute; 826 | right: 0; 827 | text-align: right; 828 | top: 0; 829 | } 830 | -------------------------------------------------------------------------------- /docs/0.72/1.md: -------------------------------------------------------------------------------- 1 | # 开始使用 XGBoost 2 | 3 | 这里是一个快速入门的教程, 它展示了让你快速在示例数据集上进行二元分类任务时的 xgboost 的代码片段. 4 | 5 | ## Links to Helpful Other Resources 6 | 7 | * 请参阅 [_安装指南_](../build.html) 以了解如何去安装 xgboost. 8 | * 请参阅 [_入门指引_](../how_to/index.html) 以了解有关使用 xgboost 的各种技巧. 9 | * 请参阅 [_学习教程_](../tutorials/index.html) 以了解有关特定任务的教程. 10 | * 请参阅 [通过例子来学习使用 XGBoost](https://github.com/dmlc/xgboost/tree/master/doc/../demo) 以了解更多代码示例. 11 | 12 | ## Python 13 | 14 | ``` 15 | import xgboost as xgb 16 | # 读取数据 17 | dtrain = xgb.DMatrix('demo/data/agaricus.txt.train') 18 | dtest = xgb.DMatrix('demo/data/agaricus.txt.test') 19 | # 通过 map 指定参数 20 | param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' } 21 | num_round = 2 22 | bst = xgb.train(param, dtrain, num_round) 23 | # 预测 24 | preds = bst.predict(dtest) 25 | 26 | ``` 27 | 28 | ## R 29 | 30 | ``` 31 | # 加载数据 32 | data(agaricus.train, package='xgboost') 33 | data(agaricus.test, package='xgboost') 34 | train <- agaricus.train 35 | test <- agaricus.test 36 | # 拟合模型 37 | bst <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1, nround = 2, 38 | nthread = 2, objective = "binary:logistic") 39 | # 预测 40 | pred <- predict(bst, test$data) 41 | 42 | ``` 43 | 44 | ## Julia 45 | 46 | ``` 47 | using XGBoost 48 | # 读取数据 49 | train_X, train_Y = readlibsvm("demo/data/agaricus.txt.train", (6513, 126)) 50 | test_X, test_Y = readlibsvm("demo/data/agaricus.txt.test", (1611, 126)) 51 | # 拟合模型 52 | num_round = 2 53 | bst = xgboost(train_X, num_round, label=train_Y, eta=1, max_depth=2) 54 | # 预测 55 | pred = predict(bst, test_X) 56 | 57 | ``` 58 | 59 | ## Scala 60 | 61 | ``` 62 | import ml.dmlc.xgboost4j.scala.DMatrix 63 | import ml.dmlc.xgboost4j.scala.XGBoost 64 | 65 | object XGBoostScalaExample { 66 | def main(args: Array[String]) { 67 | // 读取 xgboost/demo/data 目录中可用的训练数据 68 | val trainData = 69 | new DMatrix("/path/to/agaricus.txt.train") 70 | // 定义参数 71 | val paramMap = List( 72 | "eta" -> 0.1, 73 | "max_depth" -> 2, 74 | "objective" -> "binary:logistic").toMap 75 | // 迭代次数 76 | val round = 2 77 | // train the model 78 | val model = XGBoost.train(trainData, paramMap, round) 79 | // 预测 80 | val predTrain = model.predict(trainData) 81 | // 保存模型至文件 82 | model.saveModel("/local/path/to/model") 83 | } 84 | } 85 | 86 | ``` -------------------------------------------------------------------------------- /docs/0.72/10.md: -------------------------------------------------------------------------------- 1 | # 为 XGBoost 做贡献 2 | 3 | XGBoost 已经被一群活跃的社区成员开发和使用。 欢迎每个人来做贡献。这是使项目更好,更方便用户使用的一种方法。 4 | 5 | * 当你的补丁被 merged 后,请将您的名字添加到 [CONTRIBUTORS.md](https://github.com/dmlc/xgboost/tree/master/doc/CONTRIBUTORS.md) 。 6 | * 请同时更新 [NEWS.md](https://github.com/dmlc/xgboost/tree/master/doc/NEWS.md) ,以便对 API 的更改添加注释或添加新文档。 7 | 8 | ## 指导方针 9 | 10 | * [提交 Pull Request](#submit-pull-request) 11 | * [Git 工作流程](#git-workflow-howtos) 12 | * [如何解决与 master 的冲突](#how-to-resolve-conflict-with-master) 13 | * [如何将多个提交合并为一个](#how-to-combine-multiple-commits-into-one) 14 | * [force push(强制 push)的后果是什么](#what-is-the-consequence-of-force-push) 15 | * [文档](#document) 16 | * [测试用例](#testcases) 17 | * [例子](#examples) 18 | * [核心库](#core-library) 19 | * [Python 包](#python-package) 20 | * [R 包](#r-package) 21 | 22 | ## 提交 Pull Request 23 | 24 | * 在提交之前,请将您的代码重新与最新版本的 master 上的代码做一次同步(rebase),您可以这么做 25 | 26 | ``` 27 | git remote add upstream https://github.com/dmlc/xgboost 28 | git fetch upstream 29 | git rebase upstream/master 30 | 31 | ``` 32 | 33 | * 如果你有多个小提交,可以将它们 merge 到一起 (使用 git rebase 然后 squash) 成为更有意义的组。 34 | * 发送 pull request! 35 | * 修复自动检查报告的问题 36 | * 如果您正在贡献一个新模块,请考虑在 [tests](https://github.com/dmlc/xgboost/tree/master/doc/tests) 中添加一个测试用例 37 | 38 | ## Git 工作流程 39 | 40 | ### 如何解决与 master 的冲突 41 | 42 | * 首先 rebase 到最新的 master 43 | 44 | ``` 45 | # 做完一次后,可以跳过前两个步骤 46 | git remote add upstream https://github.com/dmlc/xgboost 47 | git fetch upstream 48 | git rebase upstream/master 49 | 50 | ``` 51 | 52 | * git 可能会显示一些它不能合并的冲突,比如说 `conflicted.py` 。 53 | * 手动修改文件以解决冲突。 54 | * 解决冲突后,将其标记为已解决 55 | 56 | ``` 57 | git add conflicted.py 58 | 59 | ``` 60 | 61 | * 那么你可以继续 rebase 通过 62 | 63 | ``` 64 | git rebase --continue 65 | 66 | ``` 67 | 68 | * 最后 push 到你的 fork 上,你可能需要在这里 force push(强制 push)。 69 | 70 | ``` 71 | git push --force 72 | 73 | ``` 74 | 75 | ### 如何将多个提交合并为一个 76 | 77 | 有时候我们想要合并多个 commits(提交),特别是当以后的 commits(提交)只能修复以前的提交时,创建一个有意义的提交集合的 PR 。你可以通过以下步骤来完成。 78 | 79 | * 在此之前,如果您之前没有这样做,请配置 git 的默认编辑器。 80 | 81 | ``` 82 | git config core.editor the-editor-you-like 83 | 84 | ``` 85 | 86 | * 假设我们要 merge 最后 3 个 commits,请输入以下命令 87 | 88 | ``` 89 | git rebase -i HEAD~3 90 | 91 | ``` 92 | 93 | * 它会弹出一个文本编辑器。将第一个 commit 设置为 `pick` ,将后一个 commit 更改为 `squash` 。 94 | * 保存文件之后,会弹出另一个文本编辑器,要求你修改合并的 commit message(提交信息)。 95 | * 将更改 push 到你的 fork ,你需要强制 push(force push)。 96 | 97 | ``` 98 | git push --force 99 | 100 | ``` 101 | 102 | ### force push(强制 push)的后果是什么 103 | 104 | 前两个提示需要强制 push(force push),这是因为我们改变了提交的路径。 只要提交的内容只属于你自己的内容,就可以强制 push 到自己的 fork 。 105 | 106 | ## 文档 107 | 108 | * 该文档是使用 sphinx 和 [recommonmark](http://recommonmark.readthedocs.org/en/latest/) 创建的。 109 | * 你可以在本地构建文档以查看效果。 110 | 111 | ## 测试用例 112 | 113 | * 所有的测试用例在 [tests](https://github.com/dmlc/xgboost/tree/master/doc/tests) 中。 114 | * 我们使用 python nose 进行 python 测试用例。 115 | 116 | ## 示例 117 | 118 | * 用例和示例将在 [demo](https://github.com/dmlc/xgboost/tree/master/doc/demo) 中 119 | * 我们非常高兴听到您的故事,如果您有使用 xgboost 的博客,教程代码解决方案,请告诉我们,我们将在示例页面中添加一个链接。 120 | 121 | ## 核心库 122 | 123 | * 遵循 C++ 的 Google C 的风格。 124 | * 我们使用 doxygen 来记录所有的接口代码。 125 | * 你可以通过输入 `make lint` 来重新产生 linter 。 126 | 127 | ## Python 包 128 | 129 | * 总是将 docstring(文档字符串) 添加到 numpydoc 格式的新函数中。 130 | * 你可以通过输入 `make lint` 来重新生成 linter 。 131 | 132 | ## R 包 133 | 134 | ### 代码风格 135 | 136 | * 我们在 C++ 代码上遵循 Google 的 C++ 风格指南。 137 | * 这主要与项目的其他部分保持一致。 138 | * 另一个原因是我们可以用 linter 自动检查样式。 139 | * 你可以通过在根文件夹中键入以下命令来检查代码的样式。 140 | 141 | ``` 142 | make rcpplint 143 | 144 | ``` 145 | 146 | * 在需要的时候,你可以用 `// NOLINT(*)` 注释来禁用某行的 linter 警告。 147 | 148 | ### Rmarkdown Vignettes 149 | 150 | Rmarkdown vignettes 放置在 [R-package/vignettes](https://github.com/dmlc/xgboost/tree/master/doc/R-package/vignettes) 这些 Rmarkdown 文件不被编译。我们在 [doc/R-package](https://github.com/dmlc/xgboost/tree/master/doc/how_to/R-package) 上托管编译的版本。 151 | 152 | 按照以下步骤添加一个新的 Rmarkdown vignettes: 153 | 154 | * 将原始的 rmarkdown 添加到 `R-package/vignettes` 155 | * 修改 `doc/R-package/Makefile` 来添加要构建的 markdown 文件 156 | * Clone [dmlc/web-data](https://github.com/dmlc/web-data) 仓库到 `doc` 文件夹中 157 | * 现在在 `doc/R-package` 上输入以下命令 158 | 159 | ``` 160 | make the-markdown-to-make.md 161 | 162 | ``` 163 | 164 | * 这将生成 markdown 以及 figure(图形)到 `doc/web-data/xgboost/knitr` 中 165 | * 修改 `doc/R-package/index.md` 来指向生成的 markdown 。 166 | * 将生成的 figure 添加到 `dmlc/web-data` 仓库。 167 | * 如果你已经将 repo clone 到 doc,这意味着一个 `git add` 168 | * 为 markdown 和 `dmlc/web-data` 创建 PR 169 | * 你也可以通过在 `doc` 处输入以下命令在本地生成文档 170 | 171 | ``` 172 | make html 173 | 174 | ``` 175 | 176 | 我们这样做的原因是为了避免由于生成的图像 size 导致 repo 的 size 爆炸。 -------------------------------------------------------------------------------- /docs/0.72/11.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | 此文档包含有关 xgboost 的常见问题。 4 | 5 | ## 如何调参 6 | 7 | 参阅 [_参数调整指南_](how_to/param_tuning.html) 8 | 9 | ## 模型的描述 10 | 11 | 参阅 [_介绍 Boosted Trees_](model.html) 12 | 13 | ## 我有一个很大的数据集 14 | 15 | XGBoost 被设计为 memory efficient(高效使用内存)的。通常数据符合你的内存就可以处理问题(这通常意味着数百万个实例)。 如果内存不足,请查看 [外部存储器版本](https://github.com/dmlc/xgboost/tree/master/doc/external_memory.md) 或 xgboost 的 [分布式版本](https://github.com/dmlc/wormhole/tree/master/learn/xgboost) 。 16 | 17 | ## 在平台 X(Hadoop/Yarn, Mesos)上运行 xgboost 18 | 19 | XGBoost 的分布式版本被设计为可移植到各种环境。 分布式 XGBoost 可以移植到任何支持 [rabit](https://github.com/dmlc/rabit) 的平台上。 你可以直接在 Yarn 上运行 xgboost 。理论上 Mesos 和其他资源分配引擎也可以很容易地支持。 20 | 21 | ## 为什么不在 X(Spark, Hadoop)之上实现分布式 xgboost 22 | 23 | 我们需要知道的第一个事实是分布式并不一定能解决所有的问题。 相反,它会产生更多的问题,如更多的通信开销和容错。 最终的问题还是要回到如何推动每个计算节点的限制,并使用更少的资源来完成任务(从而减少通信和失败的机会)。 24 | 25 | 为了实现这些,我们决定在单个节点 xgboost 中重用优化,并在其上构建分布式版本。 机器学习中的通信需求是相当简单的,因为我们可以依赖于一套有限的 API(在我们的案例中)。 这样的设计使我们能够重用大部分代码,同时可以移植到 Hadoop/Yarn, MPI, SGE 等主流平台上。 最重要的是,它推动了我们可以使用的计算资源的限制。 26 | 27 | ## 如何将模型移植到我自己的系统中 28 | 29 | XGBoost 的模型和数据格式是可交换的,这意味着一种语言训练的模型可以加载到另一种语言。 这意味着您可以使用 R 训练模型,同时使用 Java 或 C++ 进行预测,这在生产系统中更为常见。 您还可以使用分布式版本训练模型,并从 Python 加载它们以进行一些交互式分析。 30 | 31 | ## 你支持 LambdaMART 吗 32 | 33 | 是的,xgboost 实现了 LambdaMART 。在 [_参数_](parameter.html) 中可以查看到你想要的部分。 34 | 35 | ## 如何处理缺失值 36 | 37 | xgboost 默认是支持缺失值的。 38 | 39 | ## 运行结果略有不同 40 | 41 | 由于浮点求和顺序和多线程的非确定性,可能会发生这种情况。 虽然一般的准确性通常会保持不变。 -------------------------------------------------------------------------------- /docs/0.72/12.md: -------------------------------------------------------------------------------- 1 | # XGBoost Python Package 2 | 3 | 该页面包含软件包上所有与 python 相关的文档链接. 要安装软件包, 请参阅 [_构建和安装说明_](../build.html). 4 | 5 | ## 内容目录 6 | 7 | * [Python 教程概述](python_intro.html) 8 | * [通过例子来学习 XGBoost](https://github.com/apachecn/xgboost-doc-zh/tree/v0.60/demo/zh) 9 | * [Python API 参考](python_api.html) -------------------------------------------------------------------------------- /docs/0.72/13.md: -------------------------------------------------------------------------------- 1 | # Python 软件包介绍 2 | 3 | 本文档给出了有关 xgboost python 软件包的基本演练. 4 | 5 | **_其他有用的链接列表_** 6 | 7 | * [Python 演练代码集合](https://github.com/tqchen/xgboost/blob/master/demo/guide-python) 8 | * [Python API 参考](python_api.html) 9 | 10 | ## 安装 XGBoost 11 | 12 | 要安装 XGBoost, 请执行以下步骤: 13 | 14 | * 您需要在项目的根目录下运行 `make` 命令 15 | * 在 `python-package` 目录下运行 16 | 17 | ``` 18 | python setup.py install 19 | 20 | ``` 21 | 22 | ``` 23 | import xgboost as xgb 24 | 25 | ``` 26 | 27 | ## 数据接口 28 | 29 | XGBoost python 模块能够使用以下方式加载数据: 30 | 31 | * libsvm txt format file(libsvm 文本格式的文件) 32 | * Numpy 2D array, and(Numpy 2维数组, 以及) 33 | * xgboost binary buffer file. (xgboost 二进制缓冲文件) 34 | 35 | 这些数据将会被存在一个名为 `DMatrix` 的对象中. 36 | 37 | * 要加载 ligbsvm 文本格式或者 XGBoost 二进制文件到 `DMatrix` 对象中. 代码如下: 38 | 39 | ``` 40 | dtrain = xgb.DMatrix('train.svm.txt') 41 | dtest = xgb.DMatrix('test.svm.buffer') 42 | 43 | ``` 44 | 45 | * 要加载 numpy 的数组到 `DMatrix` 对象中, 代码如下: 46 | 47 | ``` 48 | data = np.random.rand(5,10) # 5 entities, each contains 10 features 49 | label = np.random.randint(2, size=5) # binary target 50 | dtrain = xgb.DMatrix( data, label=label) 51 | 52 | ``` 53 | 54 | * 要加载 scpiy.sparse 数组到 `DMatrix` 对象中, 代码如下: 55 | 56 | ``` 57 | csr = scipy.sparse.csr_matrix((dat, (row, col))) 58 | dtrain = xgb.DMatrix(csr) 59 | 60 | ``` 61 | 62 | * 保存 `DMatrix` 到 XGBoost 二进制文件中后, 会在下次加载时更快: 63 | 64 | ``` 65 | dtrain = xgb.DMatrix('train.svm.txt') 66 | dtrain.save_binary("train.buffer") 67 | 68 | ``` 69 | 70 | * 要处理 `DMatrix` 中的缺失值, 您可以通过指定缺失值的参数来初始化 `DMatrix`: 71 | 72 | ``` 73 | dtrain = xgb.DMatrix(data, label=label, missing = -999.0) 74 | 75 | ``` 76 | 77 | * 在需要时可以设置权重: 78 | 79 | ``` 80 | w = np.random.rand(5, 1) 81 | dtrain = xgb.DMatrix(data, label=label, missing = -999.0, weight=w) 82 | 83 | ``` 84 | 85 | ## 设置参数 86 | 87 | XGBoost 使用 pair 格式的 list 来保存 [_参数_](../parameter.html). 例如: 88 | 89 | * Booster(提升)参数 90 | 91 | ``` 92 | param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' } 93 | param['nthread'] = 4 94 | param['eval_metric'] = 'auc' 95 | 96 | ``` 97 | 98 | * 您也可以指定多个评估的指标: 99 | 100 | ``` 101 | param['eval_metric'] = ['auc', 'ams@0'] 102 | 103 | # alternativly: 104 | # plst = param.items() 105 | # plst += [('eval_metric', 'ams@0')] 106 | 107 | ``` 108 | 109 | * 指定验证集以观察性能 110 | 111 | ``` 112 | evallist = [(dtest,'eval'), (dtrain,'train')] 113 | 114 | ``` 115 | 116 | ## 训练 117 | 118 | 有用参数列表和数据以后, 您现在可以训练一个模型了. 119 | 120 | * 训练 121 | 122 | ``` 123 | num_round = 10 124 | bst = xgb.train( plst, dtrain, num_round, evallist ) 125 | 126 | ``` 127 | 128 | * 保存模型 训练之后,您可以保存模型并将其转储出去. 129 | 130 | ``` 131 | bst.save_model('0001.model') 132 | 133 | ``` 134 | 135 | * 转储模型和特征映射 您可以将模型转储到 txt 文件并查看模型的含义 136 | 137 | ``` 138 | # 转存模型 139 | bst.dump_model('dump.raw.txt') 140 | # 转储模型和特征映射 141 | bst.dump_model('dump.raw.txt','featmap.txt') 142 | 143 | ``` 144 | 145 | * 加载模型 当您保存模型后, 您可以使用如下方式在任何时候加载模型文件 146 | 147 | ``` 148 | bst = xgb.Booster({'nthread':4}) #init model 149 | bst.load_model("model.bin") # load data 150 | 151 | ``` 152 | 153 | ## 提前停止 154 | 155 | 如果您有一个验证集, 你可以使用提前停止找到最佳数量的 boosting rounds(梯度次数). 提前停止至少需要一个 `evals` 集合. 如果有多个, 它将使用最后一个. 156 | 157 | `train(..., evals=evals, early_stopping_rounds=10)` 158 | 159 | 该模型将开始训练, 直到验证得分停止提高为止. 验证错误需要至少每个 `early_stopping_rounds` 减少以继续训练. 160 | 161 | 如果提前停止,模型将有三个额外的字段: `bst.best_score`, `bst.best_iteration` 和 `bst.best_ntree_limit`. 请注意 `train()` 将从上一次迭代中返回一个模型, 而不是最好的一个. 162 | 163 | 这与两个度量标准一起使用以达到最小化(RMSE, 对数损失等)和最大化(MAP, NDCG, AUC). 请注意, 如果您指定多个评估指标, 则 `param ['eval_metric']` 中的最后一个用于提前停止. 164 | 165 | ## 预测 166 | 167 | 当您 训练/加载 一个模型并且准备好数据之后, 即可以开始做预测了. 168 | 169 | ``` 170 | # 7 个样本, 每一个包含 10 个特征 171 | data = np.random.rand(7, 10) 172 | dtest = xgb.DMatrix(data) 173 | ypred = bst.predict(xgmat) 174 | 175 | ``` 176 | 177 | 如果在训练过程中提前停止, 可以用 `bst.best_ntree_limit` 从最佳迭代中获得预测结果: 178 | 179 | ``` 180 | ypred = bst.predict(xgmat,ntree_limit=bst.best_ntree_limit) 181 | 182 | ``` 183 | 184 | ## 绘图 185 | 186 | 您可以使用 plotting(绘图)模块来绘制出 importance(重要性)以及输出的 tree(树). 187 | 188 | 要绘制出 importance(重要性), 可以使用 `plot_importance`. 该函数需要安装 `matplotlib`. 189 | 190 | ``` 191 | xgb.plot_importance(bst) 192 | 193 | ``` 194 | 195 | 输出的 tree(树)会通过 `matplotlib` 来展示, 使用 `plot_tree` 指定 target tree(目标树)的序号. 该函数需要 `graphviz` 和 `matplotlib`. 196 | 197 | ``` 198 | xgb.plot_tree(bst, num_trees=2) 199 | 200 | ``` 201 | 202 | 当您使用 `IPython` 时, 你可以使用 `to_graphviz` 函数, 它可以将 target tree(目标树)转换成 `graphviz` 实例. `graphviz` 实例会自动的在 `IPython` 上呈现. 203 | 204 | ``` 205 | xgb.to_graphviz(bst, num_trees=2) 206 | 207 | ``` -------------------------------------------------------------------------------- /docs/0.72/15.md: -------------------------------------------------------------------------------- 1 | # XGBoost 参数 2 | 3 | 在运行 XGBoost 之前, 我们必须设置三种类型的参数: 常规参数, 提升器参数和任务参数. 4 | 5 | * 常规参数与我们用于提升的提升器有关,通常是树模型或线性模型 6 | * 提升器参数取决于你所选择的提升器 7 | * 学习任务的参数决定了学习场景, 例如回归任务可以使用不同的参数进行排序相关的任务 8 | * 命令行参数的行为与 xgboost 的 CLI 版本相关 9 | 10 | ## R 中的参数 11 | 12 | 在 R 包中. 您可以使用 .(点)替换参数中下划线, 例如, 可以使用 max.depth 作为 max_depth. 下划线参数在 R 中也是有效的. 13 | 14 | ## 常规参数 15 | 16 | * booster [default=gbtree] 17 | * which booster to use, can be gbtree, gblinear or dart. gbtree and dart use tree based model while gblinear uses linear function. 18 | * silent [default=0] 19 | * 0 means printing running messages, 1 means silent mode. 20 | * nthread [default to maximum number of threads available if not set] 21 | * number of parallel threads used to run xgboost 22 | * num_pbuffer [set automatically by xgboost, no need to be set by user] 23 | * size of prediction buffer, normally set to number of training instances. The buffers are used to save the prediction results of last boosting step. 24 | * num_feature [set automatically by xgboost, no need to be set by user] 25 | * feature dimension used in boosting, set to maximum dimension of the feature 26 | 27 | ## 用于 Tree 提升的参数 28 | 29 | * eta [default=0.3] 30 | * step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new features. and eta actually shrinks the feature weights to make the boosting process more conservative. 31 | * range: [0,1] 32 | * gamma [default=0] 33 | * minimum loss reduction required to make a further partition on a leaf node of the tree. the larger, the more conservative the algorithm will be. 34 | * range: [0,∞] 35 | * max_depth [default=6] 36 | * maximum depth of a tree, increase this value will make model more complex / likely to be overfitting. 37 | * range: [1,∞] 38 | * min_child_weight [default=1] 39 | * minimum sum of instance weight(hessian) needed in a child. If the tree partition step results in a leaf node with the sum of instance weight less than min_child_weight, then the building process will give up further partitioning. In linear regression mode, this simply corresponds to minimum number of instances needed to be in each node. The larger, the more conservative the algorithm will be. 40 | * range: [0,∞] 41 | * max_delta_step [default=0] 42 | * Maximum delta step we allow each tree’s weight estimation to be. If the value is set to 0, it means there is no constraint. If it is set to a positive value, it can help making the update step more conservative. Usually this parameter is not needed, but it might help in logistic regression when class is extremely imbalanced. Set it to value of 1-10 might help control the update 43 | * range: [0,∞] 44 | * subsample [default=1] 45 | * subsample ratio of the training instance. Setting it to 0.5 means that XGBoost randomly collected half of the data instances to grow trees and this will prevent overfitting. 46 | * range: (0,1] 47 | * colsample_bytree [default=1] 48 | * subsample ratio of columns when constructing each tree. 49 | * range: (0,1] 50 | * colsample_bylevel [default=1] 51 | * subsample ratio of columns for each split, in each level. 52 | * range: (0,1] 53 | * lambda [default=1] 54 | * L2 regularization term on weights, increase this value will make model more conservative. 55 | * alpha [default=0] 56 | * L1 regularization term on weights, increase this value will make model more conservative. 57 | * tree_method, string [default=’auto’] 58 | * The tree constructtion algorithm used in XGBoost(see description in the [reference paper](http://arxiv.org/abs/1603.02754)) 59 | * Distributed and external memory version only support approximate algorithm. 60 | * Choices: {‘auto’, ‘exact’, ‘approx’} 61 | * ‘auto’: Use heuristic to choose faster one. 62 | * For small to medium dataset, exact greedy will be used. 63 | * For very large-dataset, approximate algorithm will be choosed. 64 | * Because old behavior is always use exact greedy in single machine, user will get a message when approximate algorithm is choosed to notify this choice. 65 | * ‘exact’: Exact greedy algorithm. 66 | * ‘approx’: Approximate greedy algorithm using sketching and histogram. 67 | * sketch_eps, [default=0.03] 68 | * This is only used for approximate greedy algorithm. 69 | * This roughly translated into `O(1 / sketch_eps)` number of bins. Compared to directly select number of bins, this comes with theoretical ganrantee with sketch accuracy. 70 | * Usuaully user do not have to tune this. but consider set to lower number for more accurate enumeration. 71 | * range: (0, 1) 72 | * scale_pos_weight, [default=0] 73 | * Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases) See [_Parameters Tuning_](how_to/param_tuning.html) for more discussion. Also see Higgs Kaggle competition demo for examples: [R](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-train.R), [py1](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-numpy.py), [py2](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-cv.py), [py3](https://github.com/dmlc/xgboost/tree/master/doc/../demo/guide-python/cross_validation.py) 74 | 75 | ## 用于 Dart Booster 的其它参数 76 | 77 | * sample_type [default=”uniform”] 78 | * type of sampling algorithm. 79 | * “uniform”: dropped trees are selected uniformly. 80 | * “weighted”: dropped trees are selected in proportion to weight. 81 | * normalize_type [default=”tree”] 82 | * type of normalization algorithm. 83 | * “tree”: new trees have the same weight of each of dropped trees. 84 | * weight of new trees are 1 / (k + learnig_rate) 85 | * dropped trees are scaled by a factor of k / (k + learning_rate) 86 | * “forest”: new trees have the same weight of sum of dropped trees (forest). 87 | * weight of new trees are 1 / (1 + learning_rate) 88 | * dropped trees are scaled by a factor of 1 / (1 + learning_rate) 89 | * rate_drop [default=0.0] 90 | * dropout rate. 91 | * range: [0.0, 1.0] 92 | * skip_drop [default=0.0] 93 | * probability of skip dropout. 94 | * If a dropout is skipped, new trees are added in the same manner as gbtree. 95 | * range: [0.0, 1.0] 96 | 97 | ## 用于 Linear Booster 的参数 98 | 99 | * lambda [default=0] 100 | * L2 regularization term on weights, increase this value will make model more conservative. 101 | * alpha [default=0] 102 | * L1 regularization term on weights, increase this value will make model more conservative. 103 | * lambda_bias 104 | * L2 regularization term on bias, default 0(no L1 reg on bias because it is not important) 105 | 106 | ## 学习任务的参数 107 | 108 | Specify the learning task and the corresponding learning objective. The objective options are below: 109 | 110 | * objective [ default=reg:linear ] 111 | 112 | * “reg:linear” –linear regression 113 | * “reg:logistic” –logistic regression 114 | * “binary:logistic” –logistic regression for binary classification, output probability 115 | * “binary:logitraw” –logistic regression for binary classification, output score before logistic transformation 116 | * “count:poisson” –poisson regression for count data, output mean of poisson distribution 117 | * max_delta_step is set to 0.7 by default in poisson regression (used to safeguard optimization) 118 | * “multi:softmax” –set XGBoost to do multiclass classification using the softmax objective, you also need to set num_class(number of classes) 119 | * “multi:softprob” –same as softmax, but output a vector of ndata * nclass, which can be further reshaped to ndata, nclass matrix. The result contains predicted probability of each data point belonging to each class. 120 | * “rank:pairwise” –set XGBoost to do ranking task by minimizing the pairwise loss 121 | * “reg:gamma” –gamma regression for severity data, output mean of gamma distribution 122 | 123 | * base_score [ default=0.5 ] 124 | * the initial prediction score of all instances, global bias 125 | * for sufficent number of iterations, changing this value will not have too much effect. 126 | * eval_metric [ default according to objective ] 127 | * evaluation metrics for validation data, a default metric will be assigned according to objective( rmse for regression, and error for classification, mean average precision for ranking ) 128 | * User can add multiple evaluation metrics, for python user, remember to pass the metrics in as list of parameters pairs instead of map, so that latter ‘eval_metric’ won’t override previous one 129 | * The choices are listed below: 130 | * “rmse”: [root mean square error](http://en.wikipedia.org/wiki/Root_mean_square_error) 131 | * “mae”: [mean absolute error](https://en.wikipedia.org/wiki/Mean_absolute_error) 132 | * “logloss”: negative [log-likelihood](http://en.wikipedia.org/wiki/Log-likelihood) 133 | * “error”: Binary classification error rate. It is calculated as #(wrong cases)/#(all cases). For the predictions, the evaluation will regard the instances with prediction value larger than 0.5 as positive instances, and the others as negative instances. 134 | * “merror”: Multiclass classification error rate. It is calculated as #(wrong cases)/#(all cases). 135 | * “mlogloss”: [Multiclass logloss](https://www.kaggle.com/wiki/MultiClassLogLoss) 136 | * “auc”: [Area under the curve](http://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_curve) for ranking evaluation. 137 | * “ndcg”:[Normalized Discounted Cumulative Gain](http://en.wikipedia.org/wiki/NDCG) 138 | * “map”:[Mean average precision](http://en.wikipedia.org/wiki/Mean_average_precision#Mean_average_precision) 139 | * “ndcg@n”,”map@n”: n can be assigned as an integer to cut off the top positions in the lists for evaluation. 140 | * “ndcg-”,”map-”,”ndcg@n-”,”map@n-”: In XGBoost, NDCG and MAP will evaluate the score of a list without any positive samples as 1\. By adding “-” in the evaluation metric XGBoost will evaluate these score as 0 to be consistent under some conditions. training repeatively 141 | * “gamma-deviance”: [residual deviance for gamma regression] 142 | * seed [ default=0 ] 143 | 144 | * random number seed. 145 | 146 | ## 命令行参数 147 | 148 | The following parameters are only used in the console version of xgboost 149 | 150 | * use_buffer [ default=1 ] 151 | 152 | * Whether to create a binary buffer from text input. Doing so normally will speed up loading times 153 | 154 | * num_round 155 | 156 | * The number of rounds for boosting 157 | 158 | * data 159 | * The path of training data 160 | * test:data 161 | * The path of test data to do prediction 162 | * save_period [default=0] 163 | 164 | * the period to save the model, setting save_period=10 means that for every 10 rounds XGBoost will save the model, setting it to 0 means not save any model during training. 165 | 166 | * task [default=train] options: train, pred, eval, dump 167 | * train: training using data 168 | * pred: making prediction for test:data 169 | * eval: for evaluating statistics specified by eval[name]=filename 170 | * dump: for dump the learned model into text format(preliminary) 171 | * model_in [default=NULL] 172 | * path to input model, needed for test, eval, dump, if it is specified in training, xgboost will continue training from the input model 173 | * model_out [default=NULL] 174 | * path to output model after training finishes, if not specified, will output like 0003.model where 0003 is number of rounds to do boosting. 175 | * model_dir [default=models] 176 | * The output directory of the saved models during training 177 | * fmap 178 | * feature map, used for dump model 179 | * name_dump [default=dump.txt] 180 | * name of model dump file 181 | * name_pred [default=pred.txt] 182 | * name of prediction file, used in pred mode 183 | * pred_margin [default=0] 184 | * predict margin instead of transformed probability -------------------------------------------------------------------------------- /docs/0.72/2.md: -------------------------------------------------------------------------------- 1 | # XGBoost 教程 2 | 3 | 本节包含 XGBoost 包中的官方教程。 参阅 [Awesome XGBoost](https://github.com/dmlc/xgboost/tree/master/demo) 找到更多的资源。 4 | 5 | ## 目录 6 | 7 | * [Boosted Trees 介绍](../model.html) 8 | * [在 AWS 上的分布式 XGBoost YARN](aws_yarn.html) 9 | * [DART booster](dart.html) -------------------------------------------------------------------------------- /docs/0.72/3.md: -------------------------------------------------------------------------------- 1 | # Boosted Trees 介绍 2 | 3 | XGBoost 是 “Extreme Gradient Boosting” 的缩写,其中 “Gradient Boosting” 一词在论文 _Greedy Function Approximation: A Gradient Boosting Machine_ 中,由 Friedman 提出。 XGBoost 基于这个原始模型。 这是 gradient boosted trees(梯度增强树)的教程,大部分内容是基于 xgboost 的作者的这些 [slides](http://homes.cs.washington.edu/~tqchen/pdf/BoostedTree.pdf) 。 4 | 5 | GBM (boosted trees,增强树)已经有一段时间了,关于这个话题有很多的材料。 这个教程试图用监督学习的元素以独立和有原则的方式解释 boosted trees (增强树)。 我们认为这个解释更加清晰,更加正式,并激发了 xgboost 中使用的变体。 6 | 7 | ## 监督学习的要素 8 | 9 | XGBoost 用于监督学习问题,我们使用训练数据 ![](img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg) 来预测目标变量 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 。 在我们深入了解 boosted trees 之前,首先回顾一下监督学习的重要组成部件。 10 | 11 | ### 模型和参数 12 | 13 | 监督学习中的 **_model(模型)_** 通常是指给定输入 ![](img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg) 如何去预测输出 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 的数学结构。 例如,一个常见的模型是一个 _linear model(线性模型)_(如线性回归和 logistic regression),其中的预测是由 ![](img/0.72/7d80469ba9822a0d05b7140b4ca0290a.jpg) 给出的,这是加权输入特征的线性组合(线性叠加的方式)。 其实这里的预测 ![](img/0.72/4028c0134b3b847f0e97b4cd284bc927.jpg) 可以有不同的解释,取决于做的任务。 例如,我们可以通过 logistic 转换得到 logistic regression 中 positive 类别的概率,当我们想要对输出结果排序的时候,也可以作为排序得分指标等。 14 | 15 | **_parameters(参数)_** 是我们需要从数据中学习的未确定部分。在线性回归问题中,参数是系数 ![](img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg) 。 通常我们使用 ![](img/0.72/87142829e4107d70b9cae3f8b2d095fc.jpg) 来表示参数。 16 | 17 | ### 目标函数:训练损失 + 正则 18 | 19 | 基于对 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 的不同理解,我们可以得到不同的问题,比如回归,分类,排序等。 我们需要找到一种方法来找到训练数据的最佳参数。为了做到这一点,我们需要定义一个所谓的 **_objective function(目标函数)_** 以给定一组参数来衡量模型的性能。 20 | 21 | 关于目标函数的一个非常重要的事实是,它们 **_must always(必须总是)_** 包含两个部分:training loss (训练损失) 和 regularization(正则化)。 22 | 23 | ![](img/0.72/f9a24042b2fe37eb28c8462d0195c985.jpg) 24 | 25 | 其中 ![](img/0.72/dd45717d5b8500473d4d5cc5e8da2d43.jpg) 是训练损失函数, ![](img/0.72/94f79ae2273f820cc565fdebf14a9f63.jpg) 是正则化项。 training loss (训练损失)衡量我们的数据对训练数据的预测性。 例如,常用的训练损失是 mean squared error(均方误差,MSE)。 26 | 27 | ![](img/0.72/1d3fcd8d09d65c0ee710f95bf8422ad9.jpg) 28 | 29 | 另一个常用的损失函数是 logistic 回归的 logistic 损失。 30 | 31 | ![](img/0.72/0507a5548594983588fdc7c98687b36b.jpg) 32 | 33 | **_regularization term(正则化项)_** 是人们通常忘记添加的内容。正则化项控制模型的复杂性,这有助于避免过拟合。 这听起来有些抽象,那么我们在下面的图片中考虑下面的问题。在图像左上角给出输入数据点的情况下,要求您在视觉上 _fit(拟合)_ 一个 step function(阶梯函数)。 您认为三种中的哪一种解决方案是最拟合效果最好的? 34 | 35 | ![Step function](img/0.72/2d3bec80be56303ea525a39cd4395d5c.jpg) 36 | 37 | 答案已经标注为红色了。请思考一下这个是否在你的视觉上较为合理?总的原则是我们想要一个 **_simple(简单)_** 和 **_predictive(可预测)_** 的模型。 两者之间的权衡也被称为机器学习中的 bias-variance tradeoff(偏差-方差 权衡)。 38 | 39 | 对于线性模型常见的正则化项有 ![](img/0.72/c9379d9b2e521341735b00d845051d04.jpg) 正则和 ![](img/0.72/ff439882e70c47df87d58c837a372490.jpg) 正则。这样的目标函数的设计来自于统计学习中的一个重要概念,也是我们刚才说的, bias-variance tradeoff(偏差-方差 权衡)。比较感性的理解, Bias 可以理解为假设我们有无限多数据的时候,可以训练出最好的模型所拿到的误差。而 Variance 是因为我们只有有限数据,其中随机性带来的误差。目标中误差函数鼓励我们的模型尽可能去拟合训练数据,这样相对来说最后的模型会有比较小的 bias 。而正则化项则鼓励更加简单的模型。因为当模型简单之后,有限数据拟合出来结果的随机性比较小,不容易过拟合,使得最后模型的预测更加稳定。 40 | 41 | ### 为什么要介绍 general principle(一般原则) 42 | 43 | 上面介绍的要素构成了监督学习的基本要素,它们自然是机器学习工具包的基石。 例如,你应该能够描述 boosted trees 和 random forests 之间的差异和共同点。 以正式的方式理解这个过程也有助于我们理解我们正在学习的目标以及启发式算法背后的原因,例如 pruning 和 smoothing 。 44 | 45 | ## tree ensembles(树集成) 46 | 47 | 既然我们已经介绍了监督学习的内容,那么接下来让我们开始介绍真正的 trees 吧。 首先,让我们先来了解一下 xgboost 的 **_model(模型)_** : tree ensembles(树集成)。 树集成模型是一组 classification and regression trees (CART)。 下面是一个 CART 的简单的示例,它可以分类是否有人喜欢电脑游戏。 48 | 49 | ![CART](img/0.72/1476c1e968148d38644efcce09c2bef4.jpg) 50 | 51 | 我们把一个家庭的成员分成不同的叶子,并把他们分配到相应的叶子节点上。 CART 与 decision trees(决策树)有些许的不同,就是叶子只包含决策值。在 CART 中,每个叶子都有一个 real score (真实的分数),这给了我们更丰富的解释,超越了分类。 这也使得统一的优化步骤更容易,我们将在本教程的后面部分看到。 52 | 53 | 通常情况下,单棵树由于过于简单而不够强大到可以支持在实践中使用的。实际使用的是所谓的 tree ensemble model(树集成模型),它将多棵树的预测加到一起。 54 | 55 | ![TwoCART](img/0.72/35b6f55e2b5953ff94ee568f744b4efb.jpg) 56 | 57 | 上图是两棵树的集成的例子。将每棵树的预测分数加起来得到最终分数。 如果你看一下这个例子,一个重要的事实就是两棵树互相 _complement(补充)_ 。 在数学表示上,我们可以在表单中编写我们的模型。 58 | 59 | ![](img/0.72/8a5adca27b799741caabbdeae20be5cf.jpg) 60 | 61 | 其中 ![](img/0.72/ce9bf02722174f83b83dc21985022455.jpg) 是树的数量, ![](img/0.72/a96052742f7423a92cfcad03a185fa63.jpg) 是函数空间 ![](img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg) 的函数, ![](img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg) 是所有可能的 CARTs 的集合。所以我们优化的目标可以写成 62 | 63 | ![](img/0.72/b999689ef453cce06ffd631a571e1f29.jpg) 64 | 65 | 那么问题来了,random forests(随机森林)的 _model(模型)_ 是什么?这正是 tree ensembles(树集成)!所以 random forests 和 boosted trees 在模型上并没有什么不同,不同之处在于我们如何训练它们。这意味着如果你写一个 tree ensembles(树集成)的预测服务,你只需要编写它们中的一个,它们应该直接为 random forests(随机森林)和 boosted trees(增强树)工作。这也是监督学习基石元素的一个例子。 66 | 67 | ## Tree Boosting 68 | 69 | 在介绍完模型之后,我们从真正的训练部分开始。我们应该怎么学习 trees 呢? 答案是,对于所有的监督学习模型都一样的处理:_定义一个合理的目标函数,然后去尝试优化它_! 70 | 71 | 假设我们有以下目标函数(记住它总是需要包含训练损失和正则化) 72 | 73 | ![](img/0.72/4dc70a02830b485f3f26015c8fb1fdb9.jpg) 74 | 75 | ### 附加训练 76 | 77 | 我们想要问的第一件事就是树的 **_parameters(参数)_** 是什么。 你可能已经发现了,我们要学习的是那些函数 ![](img/0.72/0d22e8726e5829598054d2585d7c9370.jpg) ,每个函数都包含树的结构和叶子分数。这比传统的你可以找到捷径的优化问题要难得多。在 tree ensemble 中,参数对应了树的结构,以及每个叶子节点上面的预测分数。 一次性训练所有的树并不容易。 相反,我们使用一个附加的策略:优化好我们已经学习完成的树,然后一次添加一棵新的树。 我们通过 ![](img/0.72/17131c421b074dc314397e82a4528438.jpg) 来关注步骤 ![](img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg) 的预测值,所以我们有 78 | 79 | ![](img/0.72/09858ff3ca719faf578ad5b13b3c98fa.jpg) 80 | 81 | 另外还有一个问题,每一步我们想要哪棵 tree 呢?一个自然而然的事情就是添加一个优化我们目标的方法。 82 | 83 | ![](img/0.72/1fe2cf4fb357117e177388becb68d9f9.jpg) 84 | 85 | 如果我们考虑使用 MSE 作为我们的损失函数,它将是下面的形式。 86 | 87 | ![](img/0.72/25bce8f7365849fcbccf06c572280bfd.jpg) 88 | 89 | MSE 的形式比较友好,具有一阶项(通常称为残差)和二次项。 对于其他形式的损失(例如,logistic loss),获得这么好的形式并不是那么容易。 所以在一般情况下,我们把损失函数的泰勒展开到二阶 90 | 91 | ![](img/0.72/8c50b9fb6c2c85cbc672ab618d01c39b.jpg) 92 | 93 | 其中 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 被定义为 94 | 95 | ![](img/0.72/77116c2aaf28d1d862f8095806911151.jpg) 96 | 97 | 我们删除了所有的常量之后, ![](img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg) 步骤中的具体目标就变成了 98 | 99 | ![](img/0.72/b201e8f1610bd6f5f4a4799b885df578.jpg) 100 | 101 | 这成为了新树的优化目标。这个定义的一个重要优点是它只依赖于 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 。这就是 xgboost 如何支持自定义损失函数。 我们可以使用完全相同的使用 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 作为输入的 solver(求解器)来对每个损失函数进行优化,包括 logistic regression, weighted logistic regression。 102 | 103 | ### 模型复杂度 104 | 105 | 我们已经介绍了训练步骤,但是等等,还有一个重要的事情,那就是 **_regularization(正则化)_** ! 我们需要定义树的复杂度 ![](img/0.72/683c9a76e2b8489a4a3d0ffdec2ad441.jpg) 。为了做到这一点,让我们首先改进一棵树的定义 ![](img/0.72/98b4f83629c037523fd162ed4b216f51.jpg) 如下 106 | 107 | ![](img/0.72/11710d80af8ff3712f529745adf5409a.jpg) 108 | 109 | 这里 ![](img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg) 是树叶上的分数向量,![](img/0.72/ab0e7d4ab7d7b6e0a5aa4383fcdd2ee5.jpg) 是将每个数据点分配给叶子的函数,![](img/0.72/907939506800cf89ad2ed0d2d05cfabc.jpg) 是树叶的数量。 在 XGBoost 中,我们将复杂度定义为 110 | 111 | ![](img/0.72/aa297e24fc75c747a07b290638760b43.jpg) 112 | 113 | 当然有不止一种方法来定义复杂度,但是这个具体的方法在实践中运行良好。正则化是大多数树的包不那么谨慎或简单忽略的一部分。这是因为对传统的树学习算法的对待只强调提高 impurity(不纯性),而复杂度控制则是启发式的。 通过正式定义,我们可以更好地了解我们正在学习什么,是的,它在实践中运行良好。 114 | 115 | ### The Structure Score(结构分数) 116 | 117 | 这是 derivation(派生)的神奇部分。在对树模型进行重新格式化之后,我们可以用第 ![](img/0.72/8e83474bbce57dfc2d0399adceb655b3.jpg) 棵树来编写目标值如 : 118 | 119 | ![](img/0.72/2c05306f7baa0066128b8f8afd95ec37.jpg) 120 | 121 | 其中 ![](img/0.72/4ef880d0d67e58f282ce4ed79d4f9549.jpg) 是分配给第 ![](img/0.72/d9d5f5978eda3e268a05e689f897c9c6.jpg) 个叶子的数据点的索引的集合。 请注意,在第二行中,我们更改了总和的索引,因为同一叶上的所有数据点都得到了相同的分数。 我们可以通过定义 ![](img/0.72/2c864507ad886978650e8f67f3224afe.jpg) 和 ![](img/0.72/51b7cc80809f3eada5745a2e5f79b18d.jpg) 来进一步压缩表达式 : 122 | 123 | ![](img/0.72/4330c12a952e7f831231b51700bcd390.jpg) 124 | 125 | 在这个等式中 ![](img/0.72/af220a242098880c9f5524587fac68c5.jpg) 是相互独立的,形式 ![](img/0.72/ad3e76b49257d997698faa2d585c2a0a.jpg) 是二次的,对于给定的结构 ![](img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg) 的最好的 ![](img/0.72/af220a242098880c9f5524587fac68c5.jpg),我们可以得到最好的客观规约: 126 | 127 | ![](img/0.72/560afea477f6995994b0cfff8262e34d.jpg) 128 | 129 | 最后一个方程度量一个树结构 ![](img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg) **_how good(到底有多好)_** 。 130 | 131 | ![Structure Score](img/0.72/4194e8522c4e867f714b492a4439dae8.jpg) 132 | 133 | 如果这一切听起来有些复杂,我们来看一下图片,看看分数是如何计算的。 基本上,对于一个给定的树结构,我们把统计 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) push 到它们所属的叶子上,统计数据加和到一起,然后使用公式计算树是多好。 除了考虑到模型的复杂度,这个分数就像决策树中的杂质测量一样(例如,熵/GINI系数)。 134 | 135 | ### 学习树结构 136 | 137 | 既然我们有了一个方法来衡量一棵树有多好,理想情况下我们会列举所有可能的树并挑选出最好的树。 在实践中,这种方法是比较棘手的,所以我们会尽量一次优化树的一个层次。 具体来说,我们试图将一片叶子分成两片,并得到分数 138 | 139 | ![](img/0.72/b8afcf3f3647596ed0584af454f840a9.jpg) 140 | 141 | 这个公式可以分解为 1) 新左叶上的得分 2) 新右叶上的得分 3) 原始叶子上的得分 4) additional leaf(附加叶子)上的正则化。 我们可以在这里看到一个重要的事实:如果增益小于 ![](img/0.72/cdab9437b701fd21fb3294cfba7c4bc2.jpg),我们最好不要添加那个分支。这正是基于树模型的 **_pruning(剪枝)_** 技术!通过使用监督学习的原则,我们自然会想出这些技术工作的原因 :) 142 | 143 | 对于真实有价值的数据,我们通常要寻找一个最佳的分割。为了有效地做到这一点,我们把所有的实例按照排序顺序排列,如下图所示。 ![Best split](img/0.72/728afccdae39c1bac6479386dab442e8.jpg) 144 | 145 | 然后从左到右的扫描就足以计算所有可能的拆分解决方案的结构得分,我们可以有效地找到最佳的拆分。 146 | 147 | ## XGBoost 最后的话 148 | 149 | 既然你明白了什么是 boosted trees 了,你可能会问这在 [XGBoost](https://github.com/dmlc/xgboost) 中的介绍在哪里? XGBoost 恰好是本教程中引入的正式原则的动力! 更重要的是,在 **_systems optimization(系统优化)_** 和 **_principles in machine learning(机器学习原理)_** 方面都有深入的研究。 这个库的目标是推动机器计算极限的极端,以提供一个 **_scalable(可扩展)_**, **_portable(可移植)_** 和 **_accurate(精确的)_** 库。 确保你 [试一试](https://github.com/dmlc/xgboost),最重要的是,向社区贡献你的智慧(代码,例子,教程)! -------------------------------------------------------------------------------- /docs/0.72/4.md: -------------------------------------------------------------------------------- 1 | # AWS 上的分布式 XGBoost YARN 2 | 3 | 这是关于如何在 AWS EC2 集群上设置和运行分布式 [XGBoost](https://github.com/dmlc/xgboost) 的分步教程。分布式 XGBoost 运行在各种平台上,如 MPI, SGE 和 Hadoop YARN 。 在本教程中,我们使用 YARN 作为示例,因为这是分布式计算广泛使用的解决方案。 4 | 5 | ## 准备条件 6 | 7 | 我们需要获得一个 [AWS key-pair(密钥对)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) 来访问 AWS 服务。我们假设我们正在使用一个 `mykey` 的 key(键)和相应的权限文件 `mypem.pem` 。 8 | 9 | 我们还需要 [AWS credentials](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html),其中包括 `ACCESS_KEY_ID` 和 `SECRET_ACCESS_KEY` 。 10 | 11 | 最后,我们需要一个 S3 bucket(桶)来托管数据和模型, `s3://mybucket/` 12 | 13 | ## 设置 Hadoop YARN 集群 14 | 15 | 本节将介绍如何从头开始部署 Hadoop YARN 集群。 如果你已经有一个部署好的 Hadoop YARN 集群,那么你可以直接跳过这一步。 我们将使用 [yarn-ec2](https://github.com/tqchen/yarn-ec2) 来启动集群。 16 | 17 | 我们可以先使用下面的命令来 clone yarn-ec2 脚本 18 | 19 | ``` 20 | git clone https://github.com/tqchen/yarn-ec2 21 | 22 | ``` 23 | 24 | 要使用该脚本,我们必须将环境变量 `AWS_ACCESS_KEY_ID` 和 `AWS_SECRET_ACCESS_KEY` 设置正确。这可以通过在 `~/.bashrc` 中添加以下两行来完成(用正确的替换字符串) 25 | 26 | ``` 27 | export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE 28 | export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 29 | 30 | ``` 31 | 32 | 现在我们可以从 EC2 启动集群的 master 了 33 | 34 | ``` 35 | ./yarn-ec2 -k mykey -i mypem.pem launch xgboost 36 | 37 | ``` 38 | 39 | 等待几分钟,直到 master 启动完成。 40 | 41 | master 机器启动之后,可以使用以下命令查询 master 机器的公共 DNS 。 42 | 43 | ``` 44 | ./yarn-ec2 -k mykey -i mypem.pem get-master xgboost 45 | 46 | ``` 47 | 48 | 它会显示 master 机器的公共 DNS 就像下面这样 `ec2-xx-xx-xx.us-west-2.compute.amazonaws.com` 现在我们可以打开浏览器,输入(用 master DNS 替换 DNS) 49 | 50 | ``` 51 | ec2-xx-xx-xx.us-west-2.compute.amazonaws.com:8088 52 | 53 | ``` 54 | 55 | 这将显示 YARN 集群的 job tracker 。需要注意的是,在 master 完成引导和启动 job tracker 之前我们可能需要等待几分钟。 56 | 57 | 在 master 机器启动后,我们可以自由添加更多的 slave 机器到集群中。 以下的命令将 m3.xlarge 实例添加到集群中了。 58 | 59 | ``` 60 | ./yarn-ec2 -k mykey -i mypem.pem -t m3.xlarge -s 2 addslave xgboost 61 | 62 | ``` 63 | 64 | 我们也可以选择添加两个 spot 实例 65 | 66 | ``` 67 | ./yarn-ec2 -k mykey -i mypem.pem -t m3.xlarge -s 2 addspot xgboost 68 | 69 | ``` 70 | 71 | slave 机器将启动,引导并向 master 报告。 你可以单击 job tracker 上的 Nodes 链接来检查 slave 机器是否已连接。 或者只需输入以下 URL(将 DNS 替换为 master DNS) 72 | 73 | ``` 74 | ec2-xx-xx-xx.us-west-2.compute.amazonaws.com:8088/cluster/nodes 75 | 76 | ``` 77 | 78 | 我们需要注意的一件事情是,并不是 job tracker 中的所有的链接都会起作用。 这是由于它们中的许多使用 AWS 的私有 IP,只能由 EC2 访问。 我们可以使用 ssh 代理来访问这些包。 现在我们已经建立了一个 master 和两个 slaves 的集群。我们准备好运行这个实验。 79 | 80 | ## 使用 S3 构建 XGBoost 81 | 82 | 我们可以通过以下命令登录到 master 服务器上。 83 | 84 | ``` 85 | ./yarn-ec2 -k mykey -i mypem.pem login xgboost 86 | 87 | ``` 88 | 89 | 我们将使用 S3 来托管数据和结果模型,因此在集群关闭后数据不会丢失。 要做到这一点,我们需要构建 S3 支持的 xgboost 。我们唯一需要做的就是设置 `USE_S3` 变量为 true 。这可以通过以下的命令来实现。 90 | 91 | ``` 92 | git clone --recursive https://github.com/dmlc/xgboost 93 | cd xgboost 94 | cp make/config.mk config.mk 95 | echo "USE_S3=1" >> config.mk 96 | make -j4 97 | 98 | ``` 99 | 100 | 现在我们已经构建了 S3 支持的 XGBoost 。如果您打算在 HDFS 上存储数据,您也可以启用 HDFS 支持,只需要打开 `USE_HDFS` 就可以了。 101 | 102 | XGBoost 也依赖环境变量来访问 S3,所以你需要在 `~/.bashrc` 中添加以下两行(用正确的字符串替换)在 master 机器上也是如此。 103 | 104 | ``` 105 | export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE 106 | export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 107 | export BUCKET=mybucket 108 | 109 | ``` 110 | 111 | ## 在 S3 上托管数据 112 | 113 | 在这个例子中,我们将把 xgboost 中的示例数据集复制到 S3 bucket(存储桶)中作为输入。 在正常使用情况下,数据集通常是从 existing distributed processing pipeline (现有的分布式处理 pipeline)创建的。 我们可以使用 [s3cmd](http://s3tools.org/s3cmd) 将数据复制到 mybucket(用真实的 bucket 名称替换 ${BUCKET}) 。 114 | 115 | ``` 116 | cd xgboost 117 | s3cmd put demo/data/agaricus.txt.train s3://${BUCKET}/xgb-demo/train/ 118 | s3cmd put demo/data/agaricus.txt.test s3://${BUCKET}/xgb-demo/test/ 119 | 120 | ``` 121 | 122 | ## 提交作业 123 | 124 | 现在一切准备就绪,我们可以将 xgboost 分布式作业提交到 YARN 集群了。 我们将使用 [dmlc-submit](https://github.com/dmlc/dmlc-core/tree/master/tracker) 脚本来提交作业。 125 | 126 | 现在我们可以在 distributed training folder(分布式训练文件夹)(用真实的 bucket 名称替换 ${BUCKET}) 中运行以下脚本。 127 | 128 | ``` 129 | cd xgboost/demo/distributed-training 130 | # Use dmlc-submit to submit the job. 131 | ../../dmlc-core/tracker/dmlc-submit --cluster=yarn --num-workers=2 --worker-cores=2\ 132 | ../../xgboost mushroom.aws.conf nthread=2\ 133 | data=s3://${BUCKET}/xgb-demo/train\ 134 | eval[test]=s3://${BUCKET}/xgb-demo/test\ 135 | model_dir=s3://${BUCKET}/xgb-demo/model 136 | 137 | ``` 138 | 139 | 所有配置如 `data` 和 `model_dir` 也可以直接写入配置文件。 请注意,我们只指定文件的文件夹路径,而不是文件名。 XGBoost 将读取该文件夹下的所有文件作为训练和评估数据。 140 | 141 | 在这个命令中,我们使用了 2 个 workers,每个 worker 使用两个正在运行的线程。 XGBoost 可以从每个 worker 使用多个 cores 中受益。 工作 cores 的常见的选择范围从 4 到 8 。 训练好的模型将被保存到指定的模型文件夹中。您可以浏览模型文件夹。 142 | 143 | ``` 144 | s3cmd ls s3://${BUCKET}/xgb-demo/model/ 145 | 146 | ``` 147 | 148 | 以下是分布式训练的输出示例。 149 | 150 | ``` 151 | 16/02/26 05:41:59 INFO dmlc.Client: jobname=DMLC[nworker=2]:xgboost,username=ubuntu 152 | 16/02/26 05:41:59 INFO dmlc.Client: Submitting application application_1456461717456_0015 153 | 16/02/26 05:41:59 INFO impl.YarnClientImpl: Submitted application application_1456461717456_0015 154 | 2016-02-26 05:42:05,230 INFO @tracker All of 2 nodes getting started 155 | 2016-02-26 05:42:14,027 INFO [05:42:14] [0] test-error:0.016139 train-error:0.014433 156 | 2016-02-26 05:42:14,186 INFO [05:42:14] [1] test-error:0.000000 train-error:0.001228 157 | 2016-02-26 05:42:14,947 INFO @tracker All nodes finishes job 158 | 2016-02-26 05:42:14,948 INFO @tracker 9.71754479408 secs between node start and job finish 159 | Application application_1456461717456_0015 finished with state FINISHED at 1456465335961 160 | 161 | ``` 162 | 163 | ## 分析模型 164 | 165 | 模型训练后,我们可以分析学习的模型,并将其用于未来的预测任务。 XGBoost 是一个可移植的框架,所有平台的模型都是 **_exchangable(可交换)_** 。 这意味着我们可以在 python/R/Julia 中加载训练好的模型,并利用这些语言中的 data science pipelines (数据科学 pipeline)来做模型分析和预测。 166 | 167 | 例如,你可以使用 [这个 ipython notebook](https://github.com/dmlc/xgboost/tree/master/demo/distributed-training/plot_model.ipynb) 来绘制 feature importance (特征重要性)和可视化的学习模型。 168 | 169 | ## 故障排除 170 | 171 | 遇到问题的时候,最好的方法可能是使用以下命令获取容器的 stdout 和 stderr 的日志,以检查导致问题的原因。 172 | 173 | ``` 174 | yarn logs -applicationId yourAppId 175 | 176 | ``` 177 | 178 | ## 未来发展方向 179 | 180 | 在本教程中,您已经学会了在 YARN 上使用分布式 XGBoost 。 XGBoost 是用于渐变增强的可移植和可伸缩框架。 您可以在 [资源页面](https://github.com/dmlc/xgboost/blob/master/demo/README.md) 中查看更多的示例和资源。 181 | 182 | 该项目的目标是为所有平台提供最佳的可扩展机器学习解决方案。 API 被设计为可移植的,相同的代码也可以在其他平台上运行,例如 MPI 和 SGE 。 XGBoost 正在积极发展,我们正在开发更多令人兴奋的功能,如分布式 xgboost python/R 包。查看 [路线图](https://github.com/dmlc/xgboost/issues/873) 来了解更多的细节并且欢迎你为这个项目你做出贡献。 -------------------------------------------------------------------------------- /docs/0.72/5.md: -------------------------------------------------------------------------------- 1 | # DART booster 2 | 3 | [XGBoost](https://github.com/dmlc/xgboost) 主要是将大量带有较小的 Learning rate (学习率) 的回归树做了混合。 在这种情况下,在构造前期增加树的意义是非常显著的,而在后期增加树并不那么重要。 4 | 5 | Rasmi 等人从深度神经网络社区提出了一种新的方法来增加 boosted trees 的 dropout 技术,并且在某些情况下能得到更好的结果。 6 | 7 | 这是一种新型树结构 booster `dart` 的使用指南。 8 | 9 | ## 原始论文 10 | 11 | Rashmi Korlakai Vinayak, Ran Gilad-Bachrach. “DART: Dropouts meet Multiple Additive Regression Trees.” [JMLR](http://www.jmlr.org/proceedings/papers/v38/korlakaivinayak15.pdf) 12 | 13 | ## 特性 14 | 15 | * 直接 drop 树来解决 over-fitting(过拟合)。 16 | * Trivial trees 会被阻止(纠正微不足道的错误)。 17 | 18 | 由于训练过程中的引入的随机性,会有下面的几点区别。 19 | 20 | * 训练可能会比 `gbtree` 慢,因为随机地 dropout 会禁止使用 prediction buffer (预测缓存区)。 21 | * 由于随机性,提早停止可能会不稳定。 22 | 23 | ## 它是如何运行的 24 | 25 | * 在第 ![](img/0.72/bac9598d3338ed61b7a118621dedea77.jpg) 轮训练中,假设 ![](img/0.72/4c8dff663d8cee873b593e54d56baccb.jpg) 个树被选定 drop 。 26 | * 使用 ![](img/0.72/43354e497c557600517f0d5839d8c4e7.jpg) 作为 drop 的树的 leaf scores (叶子分数)和 ![](img/0.72/4451c509ff07f4326844859d1bbb7a56.jpg) 作为新树的 leaf scores (叶子分数)。 27 | * 下面是目标函数 : 28 | 29 | ![](img/0.72/5ec429f9c4fa5c7660b705bcf8723ac9.jpg) 30 | 31 | * ![](img/0.72/f3d01ce46b3fe38877c9cc0f7d12db03.jpg) 和 ![](img/0.72/c347c8efe6d5830b8c0cf3828e8275db.jpg) 是 overshooting (超调), 所以使用 scale factor (比例因子) 32 | 33 | ![](img/0.72/40168c626a126a5ece60aa03c2ef69b0.jpg) 34 | 35 | ## 参数 36 | 37 | ### booster 38 | 39 | * `dart` 40 | 41 | 这个 booster 继承了 `gbtree` ,所以 `dart` 还有 `eta`, `gamma`, `max_depth` 等等参数。 42 | 43 | 其他的参数如下所示。 44 | 45 | ### sample_type 46 | 47 | sampling (采样)算法的类型。 48 | 49 | * `uniform`: (默认) drop 的树被统一选择。 50 | * `weighted`: 根据 weights(权重)选择 drop 的树。 51 | 52 | ### normalize_type 53 | 54 | normalization (归一化)算法的类型。 55 | 56 | * `tree`: (默认) 新树与 drop 的树的 weight(权重)相同。 57 | 58 | ![](img/0.72/d9f69ea79be64a6a07e67d338aafe6aa.jpg) 59 | 60 | * `forest`: 新树具有与 drop 的树(森林)的权重的总和相同的权重。 61 | 62 | ![](img/0.72/5aa5a49c3668860ed0ac3e6b62d3cc93.jpg) 63 | 64 | ### rate_drop 65 | 66 | dropout 比率. 67 | 68 | * 范围: [0.0, 1.0] 69 | 70 | ### skip_drop 71 | 72 | 跳过 dropout 的概率。 73 | 74 | * 如果一个 dropout 被跳过了,新的树将会像 gbtree 一样被添加。 75 | * 范围: [0.0, 1.0] 76 | 77 | ## 示例脚本 78 | 79 | ``` 80 | import xgboost as xgb 81 | # read in data 82 | dtrain = xgb.DMatrix('demo/data/agaricus.txt.train') 83 | dtest = xgb.DMatrix('demo/data/agaricus.txt.test') 84 | # specify parameters via map 85 | param = {'booster': 'dart', 86 | 'max_depth': 5, 'learning_rate': 0.1, 87 | 'objective': 'binary:logistic', 'silent': True, 88 | 'sample_type': 'uniform', 89 | 'normalize_type': 'tree', 90 | 'rate_drop': 0.1, 91 | 'skip_drop': 0.5} 92 | num_round = 50 93 | bst = xgb.train(param, dtrain, num_round) 94 | # make prediction 95 | # ntree_limit must not be 0 96 | preds = bst.predict(dtest, ntree_limit=num_round) 97 | 98 | ``` -------------------------------------------------------------------------------- /docs/0.72/6.md: -------------------------------------------------------------------------------- 1 | # XGBoost 入门指引 2 | 3 | 该页面包含使用和开发 XGBoost 的一些指导。 4 | 5 | ## 安装 6 | 7 | * [如何安装 XGBoost](../build.html) 8 | 9 | ## 以特定的方式使用 XGBoost 10 | 11 | * [参数调整指南](param_tuning.html) 12 | * [使用大数据集的 out of core 计算](external_memory.html) 13 | 14 | ## 开发和破解 XGBoost 15 | 16 | * [为 XGBoost 做贡献](contribute.html) 17 | 18 | ## 常见问题 19 | 20 | * [FAQ](../faq.html) -------------------------------------------------------------------------------- /docs/0.72/7.md: -------------------------------------------------------------------------------- 1 | # 安装指南 2 | 3 | 该页面提供了有关如何在各种操作系统上构建和安装 xgboost 软件包的说明. 由如下两个步骤组成: 4 | 5 | 1. 首先, 从 C++ 代码中构建共享库(针对 linux/osx 的是 `libxgboost.so` 然后针对 windows 的是 `libxgboost.dll`). 6 | * Exception: 针对 R 软件包的安装请直接参考 R 软件包的部分. 7 | 2. 然后, 安装相关的编程语言软件包(例如. Python 软件包). 8 | 9 | **_重要提示_** 最新版本的 xgboost 使用子模块来维护软件包, 所以当你 clone repo 时, 记得按如下方式使用递归选项. 10 | 11 | ``` 12 | git clone --recursive https://github.com/dmlc/xgboost 13 | 14 | ``` 15 | 16 | 针对使用 github 工具的 windows 用户, 可以打开 git shell, 然后输入以下命令. 17 | 18 | ``` 19 | git submodule init 20 | git submodule update 21 | 22 | ``` 23 | 24 | 如果你在安装期间有任何问题, 请首先参考 [故障排除部分](#id5). 如果其中的说明不适合你, 请放心的到 [xgboost-doc-zh/issues](https://github.com/apachecn/xgboost-doc-zh/issues) 上提问题, 或者如果你能解决该问题, 最好发起一个 pull request. 25 | 26 | ## 页面内容目录 27 | 28 | * [构建共享库](#id3) 29 | * [在 Ubuntu/Debian 上构建](#ubuntu-debian) 30 | * [在 OSX 上构建](#osx) 31 | * [在 Windows 上构建](#windows) 32 | * [自定义构建](#id4) 33 | * [Python 软件包安装](#python) 34 | * [R 软件包安装](#r) 35 | * [故障排查](#id5) 36 | 37 | ## 构建共享库 38 | 39 | 我们的目标是构建共享库: 40 | 41 | * 在 Linux/OSX 上的目标库是 `libxgboost.so` 42 | * 在 Windows 上的目标库是 `libxgboost.dll` 43 | 44 | 最小的构建要求是 45 | 46 | * 最新的支持 C++ 11 的 c++ 编译器(g++-4.6 or higher) 47 | 48 | 我们可以编辑 `make/config.mk` 以改变编译选项, 然后通过 `make` 命令来构建. 如果一切顺利, 我们可以去特定的编程语言安装部分. 49 | 50 | ### 在 Ubuntu/Debian 上构建 51 | 52 | 在 Ubuntu 上, 构建 xgboost 的命令如下 53 | 54 | ``` 55 | git clone --recursive https://github.com/dmlc/xgboost 56 | cd xgboost; make -j4 57 | 58 | ``` 59 | 60 | ### 在 OSX 上构建 61 | 62 | 在 OSX 上, 构建 xgboost 的命令如下 63 | 64 | ``` 65 | git clone --recursive https://github.com/dmlc/xgboost 66 | cd xgboost; cp make/minimum.mk ./config.mk; make -j4 67 | 68 | ``` 69 | 70 | 这样就可以在不使用多线程的情况下构建 xgboost 了, 因为默认情况下, OSX 中的 clang 不会带有 open-mp. 有关启用 OpenMP 的 xgboost, 请参阅以下段落. 71 | 72 | 以下是使用 OpenMP 的编译器来安装 XGBoost 的完整解决方案. 通过命令 `brew install gcc --without-multilib` 获得 gcc-5.x.x 与 openmap 的支持. (brew 是 OSX 上 `apt-get` 的标准组件. 因此不建议单独安装 [HPC](http://hpc.sourceforge.net/), 但是它应该也是可用的.) 73 | 74 | ``` 75 | git clone --recursive https://github.com/dmlc/xgboost 76 | cd xgboost; cp make/config.mk ./config.mk; make -j4 77 | 78 | ``` 79 | 80 | ### 在 Windows 上构建 81 | 82 | 您在 clone repo 时需要首先使用递归选项来 clone 子模块. 如果使用的是 github 工具, 可以打开 github-shell, 然后输入以下命令. 我们推荐使用 [Windows 版本的 Git](https://git-for-windows.github.io/), 因为它自带了一个标准的 bash shell. 将极大地简化安装过程. 83 | 84 | ``` 85 | git submodule init 86 | git submodule update 87 | 88 | ``` 89 | 90 | XGBoost 支持由 MSVC 或 MinGW 来构建. 以下是你如何使用 MinGW 构建 xgboost 库的说明. 91 | 92 | 在安装完 [Windows 版本的 Git](https://git-for-windows.github.io/) 之后, 应该有一个 `Git Bash` 的快捷方式. 以下所有的步骤都可以在 `Git Bash` 中进行. 93 | 94 | 在 MinGW 中, `make` 命令是 `mingw32-make` 这个名字. 你可以添加下面的行道 `.bashrc` 文件中去. 95 | 96 | ``` 97 | alias make='mingw32-make' 98 | 99 | ``` 100 | 101 | 要使用 MinGW 来构建 102 | 103 | ``` 104 | cp make/mingw64.mk config.mk; make -j4 105 | 106 | ``` 107 | 108 | 要使用 cmake 来与 Visual Studio 2013 构建. 确保你有最新版本的 cmake 并且已添加到你的 path 中. 然后从 xgboost 目录执行以下命令: 109 | 110 | ``` 111 | mkdir build 112 | cd build 113 | cmake .. -G"Visual Studio 12 2013 Win64" 114 | 115 | ``` 116 | 117 | This specifies an out of source build using the MSVC 12 64 bit generator. Open the .sln file in the build directory and build with Visual Studio. To use the Python module you can copy libxgboost.dll into python-package\xgboost. 118 | 119 | 这指定使用 MSVC 12 64 位生成器的源代码来构建. 在构建目录中打开 .sln 文件并使用 Visual Studio 进行构建. 要使用 Python 模块, 您可以将 libxgboost.dll 复制到 python-package\xgboost 目录下去. 120 | 121 | 其他版本的 Visual Studio 可能会工作, 但未经测试. 122 | 123 | ### 自定义构建 124 | 125 | xgboost 的配置可以通过 `config.mk` 来进行修改 126 | 127 | * 修改各种分布式文件系统上的配置, 如 HDFS/Amazon S3/ ... 128 | * 首先, 复制 [make/config.mk](https://github.com/dmlc/xgboost/tree/master/doc/../make/config.mk) 到项目的根目录下, 任何本地的修改都将被 git 忽略, 然后修改相应的 flags(标记). 129 | 130 | ## Python 软件包的安装 131 | 132 | python 软件包位于 [python-package](https://github.com/dmlc/xgboost/tree/master/doc/../python-package) 目录下. 以下是几种安装软件包的方法: 133 | 134 | 1. 系统范围的安装, 需要 root 权限 135 | 136 | ``` 137 | cd python-package; sudo python setup.py install 138 | 139 | ``` 140 | 141 | 但是你需要 Python `distutils` 模块才能工作. 它通常是核心 python 软件包的一部分, 或者可以使用你的软件包管理器进行安装. 例如. 在 Debian 中使用以下命令 142 | 143 | ``` 144 | sudo apt-get install python-setuptools 145 | 146 | ``` 147 | 148 | _注意: 如果您重新编译了 xgboost, 那么您需要重新安装它才能使新库生效_ 149 | 150 | 2. 只设置环境变量 `PYTHONPATH` 来让 python 知道在哪里可以找相关的库. 例如, 假设我们在主目录 `〜` 上克隆了 `xgboost`. 那么我们可以在 `〜/ .bashrc` 文件中加入下面这行. 这是 _推荐给哪些可能更改代码的开发者_ 的. 一旦你 pull(拉取)代码并且重构该项目(不需要再次调用 `setup`), 这些更改就会立即体现出来. 151 | 152 | ``` 153 | export PYTHONPATH=~/xgboost/python-package 154 | 155 | ``` 156 | 157 | 3. 只为当前用户安装. 158 | 159 | ``` 160 | cd python-package; python setup.py develop --user 161 | 162 | ``` 163 | 164 | 4. 如果您正在安装需要编译的最新的 xgboost 版本, 请将 MinGW 添加到系统的 PATH 中去: 165 | 166 | ``` 167 | import os 168 | os.environ['PATH'] = os.environ['PATH'] + ';C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin' 169 | 170 | ``` 171 | 172 | ## R 软件包安装 173 | 174 | 您可以像安装其他软件包一样从 cran 来安装 R 软件包, 也可以从我们每周更新的 drat 软件仓库来进行安装: 175 | 176 | ``` 177 | install.packages("drat", repos="https://cran.rstudio.com") 178 | drat:::addRepo("dmlc") 179 | install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source") 180 | 181 | ``` 182 | 183 | 如果您想使用最新的 xgboost 版本, 并且已经编译了 xgboost, 请使用 `library(devtools); install('xgboost/R-package')` 来手动的安装 xgboost 软件包(根据你编译的 xgboost 来恰当的更改 path) 184 | 185 | 对于 OSX 用户, 将安装单线程版本, 要安装多线程版本. 首先按照 [在 OSX 上构建](#在 OSX 上构建) 上的说明来获取 OpenMP 激活的编译器, 然后: 186 | 187 | * 为 R 设置最高优先级的 `Makevars` 文件. 188 | 189 | 重点是, 有三种 `Makevars` : `~/.R/Makevars`, `xgboost/R-package/src/Makevars` 以及`/usr/local/Cellar/r/3.2.0/R.framework/Resources/etc/Makeconf` (最后一个通过在 R 中运行 `file.path(R.home("etc"), "Makeconf")` 来获得), 并且 `SHLIB_OPENMP_CXXFLAGS` 不是默认设置!! 在尝试后, 似乎第一个具有最高的优先级 (震精吧!). 190 | 191 | 然后在 R 中, 允许 192 | 193 | ``` 194 | install.packages("drat", repos="https://cran.rstudio.com") 195 | drat:::addRepo("dmlc") 196 | install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source") 197 | 198 | ``` 199 | 200 | 由于子模块的使用, `install_github` 不再支持安装最新版本的 R 软件包. 要安装最新的版本, 可以运行下面的 bash 脚本, 201 | 202 | ``` 203 | git clone --recursive https://github.com/dmlc/xgboost 204 | cd xgboost 205 | git submodule init 206 | git submodule update 207 | alias make='mingw32-make' 208 | cd dmlc-core 209 | make -j4 210 | cd ../rabit 211 | make lib/librabit_empty.a -j4 212 | cd .. 213 | cp make/mingw64.mk config.mk 214 | make -j4 215 | 216 | ``` 217 | 218 | ## 故障排查 219 | 220 | 1. **在 `git pull` 后编译失败** 221 | 222 | 请先 update the submodules, clean all 然后重新编译: 223 | 224 | ``` 225 | git submodule update && make clean_all && make -j4 226 | 227 | ``` 228 | 229 | 1. **在修改 `config.mk` 配置文件后编译失败** 230 | 231 | 需要先 clean all: 232 | 233 | ``` 234 | make clean_all && make -j4 235 | 236 | ``` 237 | 238 | 1. **Makefile: dmlc-core/make/dmlc.mk: No such file or directory** 239 | 240 | 我们需要递归的 clone 子模块, 您可以这样做: 241 | 242 | ``` 243 | git submodule init 244 | git submodule update 245 | 246 | ``` 247 | 248 | Alternatively, do another clone 249 | 250 | ``` 251 | git clone https://github.com/dmlc/xgboost --recursive 252 | 253 | ``` -------------------------------------------------------------------------------- /docs/0.72/8.md: -------------------------------------------------------------------------------- 1 | # 参数调整注意事项 2 | 3 | 参数调整是机器学习中的一门暗艺术,模型的最优参数可以依赖于很多场景。所以要创建一个全面的指导是不可能的。 4 | 5 | 本文档试图为 xgboost 中的参数提供一些指导意见。 6 | 7 | ## 理解 Bias-Variance(偏差-方差)权衡 8 | 9 | 如果你了解一些机器学习或者统计课程,你会发现这可能是最重要的概念之一。 当我们允许模型变得更复杂(例如深度更深)时,模型具有更好的拟合训练数据的能力,会产生一个较少的偏差模型。 但是,这样复杂的模型需要更多的数据来拟合。 10 | 11 | xgboost 中的大部分参数都是关于偏差方差的权衡的。最好的模型应该仔细地将模型复杂性与其预测能力进行权衡。 [参数文档](https://github.com/dmlc/xgboost/tree/master/doc/how_to/parameter.md) 会告诉你每个参数是否会使得模型更加 conservative (保守)与否。这可以帮助您在复杂模型和简单模型之间灵活转换。 12 | 13 | ## 控制过拟合 14 | 15 | 当你观察到训练精度高,但是测试精度低时,你可能遇到了过拟合的问题。 16 | 17 | 通常有两种方法可以控制 xgboost 中的过拟合。 18 | 19 | * 第一个方法是直接控制模型的复杂度 20 | * 这包括 `max_depth`, `min_child_weight` 和 `gamma` 21 | * 第二种方法是增加随机性,使训练对噪声强健 22 | * 这包括 `subsample`, `colsample_bytree` 23 | * 你也可以减小步长 `eta`, 但是当你这么做的时候需要记得增加 `num_round` 。 24 | 25 | ## 处理不平衡的数据集 26 | 27 | 对于广告点击日志等常见情况,数据集是极不平衡的。 这可能会影响 xgboost 模型的训练,有两种方法可以改善它。 28 | 29 | * 如果你只关心预测的排名顺序(AUC) 30 | * 通过 `scale_pos_weight` 来平衡 positive 和 negative 权重。 31 | * 使用 AUC 进行评估 32 | * 如果你关心预测正确的概率 33 | * 在这种情况下,您无法重新平衡数据集 34 | * 在这种情况下,将参数 `max_delta_step` 设置为有限数字(比如说1)将有助于收敛 -------------------------------------------------------------------------------- /docs/0.72/9.md: -------------------------------------------------------------------------------- 1 | # 使用 XGBoost 外部存储器版本(测试版) 2 | 3 | 使用外部存储器版本和内存版本没有太大的区别。 唯一的区别是文件名格式。 4 | 5 | 外部存储器版本采用以下文件名格式 6 | 7 | ``` 8 | filename#cacheprefix 9 | 10 | ``` 11 | 12 | `filename` 是要加载的 libsvm 文件的正常路径, `cacheprefix` 是一个 xgboost 将用于外部内存缓存的缓存文件的路径。 13 | 14 | 下面的代码是从 [../demo/guide-python/external_memory.py](https://github.com/dmlc/xgboost/tree/master/doc/demo/guide-python/external_memory.py) 中提取的。 15 | 16 | ``` 17 | dtrain = xgb.DMatrix('../data/agaricus.txt.train#dtrain.cache') 18 | 19 | ``` 20 | 21 | 你可以在 libsvm 文件后面找到 `#dtrain.cache` ,这是缓存文件的名称。 对于 CLI 版本,只需在文件名中使用 `"../data/agaricus.txt.train#dtrain.cache"` 。 22 | 23 | ## 性能说明 24 | 25 | * 参数 `nthread` 应该设置为 **_real_** cores 的数量 26 | * 大多数现代 CPU 提供 hyperthreading (超线程),这意味着你可以拥有 8 个线程的 4 核 CPU 27 | * 在这种情况下,将 nthread 设置为 4 以获得更高性能 28 | 29 | ## 分布式版本 30 | 31 | 外部存储器模式很自然地适用于分布式版本,您可以简单地设置路径就像这样 32 | 33 | ``` 34 | data = "hdfs:///path-to-data/#dtrain.cache" 35 | 36 | ``` 37 | 38 | xgboost 会将数据缓存到本地位置。在 YARN 上运行时,当前文件夹是暂时的,这样你就可以直接使用 `dtrain.cache` 来缓存当前文件夹。 39 | 40 | ## 用法说明 41 | 42 | * 这是一个实验版本 43 | * 如果你想尝试测试,请将结果报告至 https://github.com/dmlc/xgboost/issues/244 44 | * 目前只支持从 libsvm 格式导入 45 | * 欢迎从其他常见的外部存储器数据源采集的贡献 -------------------------------------------------------------------------------- /docs/0.72/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 贡献指南 2 | 3 | > 请您勇敢地去翻译和改进翻译。虽然我们追求卓越,但我们并不要求您做到十全十美,因此请不要担心因为翻译上犯错——在大部分情况下,我们的服务器已经记录所有的翻译,因此您不必担心会因为您的失误遭到无法挽回的破坏。(改编自维基百科) 4 | 5 | 可能有用的链接: 6 | 7 | + [0.72 英文文档](https://xgboost.readthedocs.io/en/release_0.72) 8 | 9 | 负责人: 10 | 11 | * [那伊抹微笑](https://github.com/wangyangting): 1042658081 12 | * [Peppa](https://github.com/chenyyx): 190442212 13 | 14 | ## 章节列表 15 | 16 | + [Introduction](README.md) 17 | + [开始使用 XGBoost](docs/1.md) 18 | + [XGBoost 教程](docs/2.md) 19 | + [Boosted Trees 介绍](docs/3.md) 20 | + [AWS 上的分布式 XGBoost YARN](docs/4.md) 21 | + [DART booster](docs/5.md) 22 | + [XGBoost 入门指引](docs/6.md) 23 | + 安装 24 | + [安装指南](docs/7.md) 25 | + 以特定的方式使用 XGBoost 26 | + [参数调整注意事项](docs/8.md) 27 | + [使用 XGBoost 外部存储器版本(测试版)](docs/9.md) 28 | + 开发和破解 XGBoost 29 | + [为 XGBoost 做贡献](docs/10.md) 30 | + [常见问题](docs/11.md) 31 | + [XGBoost Python Package](docs/12.md) 32 | + [Python 软件包介绍](docs/13.md) 33 | + [Python API 参考](docs/14.md) 34 | + [XGBoost 参数](docs/15.md) 35 | 36 | ## 流程 37 | 38 | ### 一、认领 39 | 40 | 首先查看[整体进度](https://github.com/apachecn/pytorch-doc-zh/issues/274),确认没有人认领了你想认领的章节。 41 | 42 | 然后回复 ISSUE,注明“章节 + QQ 号”(一定要留 QQ)。 43 | 44 | ### 二、翻译 45 | 46 | 可以合理利用翻译引擎(例如[谷歌](https://translate.google.cn/)),但一定要把它变得可读! 47 | 48 | 可以参照之前版本的中文文档,如果有用的话。 49 | 50 | 如果遇到格式问题,请随手把它改正。 51 | 52 | ### 三、提交 53 | 54 | **提交的时候不要改动文件名称,即使它跟章节标题不一样也不要改,因为文件名和原文的链接是对应的!!!** 55 | 56 | + `fork` Github 项目 57 | + 将译文放在`docs/0.72`文件夹下 58 | + `push` 59 | + `pull request` 60 | 61 | 请见 [Github 入门指南](https://github.com/apachecn/kaggle/blob/master/docs/GitHub)。 62 | -------------------------------------------------------------------------------- /docs/0.72/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/0.72/README.md -------------------------------------------------------------------------------- /docs/0.72/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | + [Introduction](README.md) 4 | + [开始使用 XGBoost](docs/1.md) 5 | + [XGBoost 教程](docs/2.md) 6 | + [Boosted Trees 介绍](docs/3.md) 7 | + [AWS 上的分布式 XGBoost YARN](docs/4.md) 8 | + [DART booster](docs/5.md) 9 | + [XGBoost 入门指引](docs/6.md) 10 | + 安装 11 | + [安装指南](docs/7.md) 12 | + 以特定的方式使用 XGBoost 13 | + [参数调整注意事项](docs/8.md) 14 | + [使用 XGBoost 外部存储器版本(测试版)](docs/9.md) 15 | + 开发和破解 XGBoost 16 | + [为 XGBoost 做贡献](docs/10.md) 17 | + [常见问题](docs/11.md) 18 | + [XGBoost Python Package](docs/12.md) 19 | + [Python 软件包介绍](docs/13.md) 20 | + [Python API 参考](docs/14.md) 21 | + [XGBoost 参数](docs/15.md) 22 | -------------------------------------------------------------------------------- /docs/0.90/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 贡献指南 2 | 3 | > 请您勇敢地去翻译和改进翻译。虽然我们追求卓越,但我们并不要求您做到十全十美,因此请不要担心因为翻译上犯错——在大部分情况下,我们的服务器已经记录所有的翻译,因此您不必担心会因为您的失误遭到无法挽回的破坏。(改编自维基百科) 4 | 5 | 可能有用的链接: 6 | 7 | + [0.72 中文文档](https://xgboost.apachecn.org/docs/0.72) 8 | + [0.72 英文文档](https://xgboost.readthedocs.io/en/release_0.72) 9 | 10 | 负责人: 11 | 12 | * [1266](https://github.com/wangweitong): 1097828409 13 | * [腻味](https://github.com/xxxx): 1185685810 14 | 15 | ## 章节列表 16 | 17 | * [Introduction](README.md) 18 | * [安装指南](https://xgboost.readthedocs.io/en/latest/build.html) 19 | * [XGBoost入门](https://xgboost.readthedocs.io/en/latest/get_started.html) 20 | * [XGBoost教程](https://xgboost.readthedocs.io/en/latest/tutorials/index.html) 21 | * [Boosted Trees简介](https://xgboost.readthedocs.io/en/latest/tutorials/model.html) 22 | * [使用AWS YARN分布式XGBoost](https://xgboost.readthedocs.io/en/latest/tutorials/aws_yarn.html) 23 | * [使用XGBoost4J-Spark的分布式XGBoost](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 24 | * [DART助推器](https://xgboost.readthedocs.io/en/latest/tutorials/dart.html) 25 | * [单调约束](https://xgboost.readthedocs.io/en/latest/tutorials/monotonic.html) 26 | * [XGBoost中的随机森林](https://xgboost.readthedocs.io/en/latest/tutorials/rf.html) 27 | * [特征交互约束](https://xgboost.readthedocs.io/en/latest/tutorials/feature_interaction_constraint.html) 28 | * [DMatrix的文本输入格式](https://xgboost.readthedocs.io/en/latest/tutorials/input_format.html) 29 | * [参数调整注意事项](https://xgboost.readthedocs.io/en/latest/tutorials/param_tuning.html) 30 | * [使用XGBoost外部存储器版本(测试版)](https://xgboost.readthedocs.io/en/latest/tutorials/external_memory.html) 31 | * [自定义目标和评估指标](https://xgboost.readthedocs.io/en/latest/tutorials/custom_metric_obj.html) 32 | * [经常问的问题](https://xgboost.readthedocs.io/en/latest/faq.html) 33 | * [XGBoost用户论坛](https://discuss.xgboost.ai/) 34 | * [GPU支持](https://xgboost.readthedocs.io/en/latest/gpu/index.html) 35 | * [XGBoost参数](https://xgboost.readthedocs.io/en/latest/parameter.html) 36 | * [Python包](https://xgboost.readthedocs.io/en/latest/python/index.html) 37 | * [Python包介绍](https://xgboost.readthedocs.io/en/latest/python/python_intro.html) 38 | * [Python API参考](https://xgboost.readthedocs.io/en/latest/python/python_api.html) 39 | * [Python示例](https://github.com/dmlc/xgboost/tree/master/demo/guide-python) 40 | * [R包](https://xgboost.readthedocs.io/en/latest/R-package/index.html) 41 | * [R中的XGBoost简介](https://xgboost.readthedocs.io/en/latest/R-package/xgboostPresentation.html) 42 | * [使用XGBoost了解您的数据集](https://xgboost.readthedocs.io/en/latest/R-package/discoverYourData.html) 43 | * [JVM包](https://xgboost.readthedocs.io/en/latest/jvm/index.html) 44 | * [XGBoost4J入门](https://xgboost.readthedocs.io/en/latest/jvm/java_intro.html) 45 | * [XGBoost4J-Spark教程](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 46 | * [代码示例](https://github.com/dmlc/xgboost/tree/master/jvm-packages/xgboost4j-example) 47 | * [XGBoost4J Java API](https://xgboost.readthedocs.io/en/latest/jvm/javadocs/index.html) 48 | * [XGBoost4J Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j/index.html) 49 | * [XGBoost4J-Spark Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-spark/index.html) 50 | * [XGBoost4J-Flink Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-flink/index.html) 51 | * [Julia包](https://xgboost.readthedocs.io/en/latest/julia.html) 52 | * [CLI界面](https://xgboost.readthedocs.io/en/latest/cli.html) 53 | * [有助于XGBoost](https://xgboost.readthedocs.io/en/latest/contribute.html) 54 | 55 | ## 流程 56 | 57 | ### 一、认领 58 | 59 | 首先查看[整体进度](https://github.com/apachecn/pytorch-doc-zh/issues/274),确认没有人认领了你想认领的章节。 60 | 61 | 然后回复 ISSUE,注明“章节 + QQ 号”(一定要留 QQ)。 62 | 63 | ### 二、翻译 64 | 65 | 可以合理利用翻译引擎(例如[谷歌](https://translate.google.cn/)),但一定要把它变得可读! 66 | 67 | 可以参照之前版本的中文文档,如果有用的话。 68 | 69 | 如果遇到格式问题,请随手把它改正。 70 | 71 | ### 三、提交 72 | 73 | **提交的时候不要改动文件名称,即使它跟章节标题不一样也不要改,因为文件名和原文的链接是对应的!!!** 74 | 75 | + `fork` Github 项目 76 | + 将译文放在`docs/0.90`文件夹下 77 | + `push` 78 | + `pull request` 79 | 80 | 请见 [Github 入门指南](https://github.com/apachecn/kaggle/blob/master/docs/GitHub)。 81 | -------------------------------------------------------------------------------- /docs/0.90/README.md: -------------------------------------------------------------------------------- 1 | #
XGBoost 中文文档
2 | 3 |
XGBoost是一个优化的分布式梯度增强库,旨在实现高效,灵活和便携。
4 | 5 | > 它在 [Gradient Boosting](https://en.wikipedia.org/wiki/Gradient_boosting) 框架下实现机器学习算法。XGBoost提供并行树提升(也称为GBDT,GBM),可以快速准确地解决许多数据科学问题。相同的代码在主要的分布式环境(Hadoop,SGE,MPI)上运行,并且可以解决数十亿个示例之外的问题。 6 | 7 |
8 | 9 | ![](docs/img/logo.png) 10 |
11 | 12 | > 欢迎任何人参与和完善:一个人可以走的很快,但是一群人却可以走的更远。 13 | 14 | * [中文地址](https://xgboost.apachecn.org/) 15 | * [英文地址](https://xgboost.ai/) 16 | + [ApacheCN 机器学习交流群 629470233](http://shang.qq.com/wpa/qunwpa?idkey=30e5f1123a79867570f665aa3a483ca404b1c3f77737bc01ec520ed5f078ddef) 17 | + [ApacheCN 学习资源](https://www.ibooker.org.cn/docs) 18 | 19 | ## 翻译进度 20 | 21 | [**贡献指南**](CONTRIBUTING.md) 22 | 23 | > 项目翻译 xgboost 0.90 24 | 25 | * 贡献者: 记得留言和更新翻译进度 26 | * 地址: https://github.com/apachecn/xgboost-doc-zh/issues/27 27 | 28 | ## 项目看板 29 | 30 | > 项目 XGBoost 0.90 看板 31 | 32 | * 负责人: 记得更新和优化 33 | * 地址: https://github.com/apachecn/xgboost-doc-zh/projects/1 34 | 35 | 36 | ## 项目负责人 37 | 38 | 格式: GitHub + QQ 39 | 40 | * [1266](https://github.com/wangweitong): 1097828409 41 | * [腻味](https://github.com/XuQiao318): 1185685810 42 | 43 | -- 负责人要求: (欢迎一起为 `XGBoost 中文版本` 做贡献) 44 | 45 | * 热爱开源,喜欢装逼 46 | * 长期使用 XGBoost 47 | * 能够有时间及时优化页面bug和用户issues 48 | * 试用期: 2个月 49 | * 欢迎联系: [片刻](https://github.com/jiangzhonglian) 529815144 50 | 51 | 52 | ## 建议反馈 53 | 54 | * 在我们的 [apachecn/xgboost-doc-zh](https://github.com/apachecn/xgboost-doc-zh) github 上提 issue. 55 | * 发邮件到 Email: `apachecn@163.com`. 56 | * 在我们的 [QQ群-搜索: 交流方式](https://github.com/apachecn/home) 中联系群主/管理员即可. 57 | 58 | ## 赞助我们 59 | 60 | 微信&支付宝 61 | 62 | -------------------------------------------------------------------------------- /docs/0.90/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](README.md) 4 | * [安装指南](https://xgboost.readthedocs.io/en/latest/build.html) 5 | * [XGBoost入门](https://xgboost.readthedocs.io/en/latest/get_started.html) 6 | * [XGBoost教程](https://xgboost.readthedocs.io/en/latest/tutorials/index.html) 7 | * [Boosted Trees简介](https://xgboost.readthedocs.io/en/latest/tutorials/model.html) 8 | * [使用AWS YARN分布式XGBoost](https://xgboost.readthedocs.io/en/latest/tutorials/aws_yarn.html) 9 | * [使用XGBoost4J-Spark的分布式XGBoost](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 10 | * [DART助推器](https://xgboost.readthedocs.io/en/latest/tutorials/dart.html) 11 | * [单调约束](https://xgboost.readthedocs.io/en/latest/tutorials/monotonic.html) 12 | * [XGBoost中的随机森林](https://xgboost.readthedocs.io/en/latest/tutorials/rf.html) 13 | * [特征交互约束](https://xgboost.readthedocs.io/en/latest/tutorials/feature_interaction_constraint.html) 14 | * [DMatrix的文本输入格式](https://xgboost.readthedocs.io/en/latest/tutorials/input_format.html) 15 | * [参数调整注意事项](https://xgboost.readthedocs.io/en/latest/tutorials/param_tuning.html) 16 | * [使用XGBoost外部存储器版本(测试版)](https://xgboost.readthedocs.io/en/latest/tutorials/external_memory.html) 17 | * [自定义目标和评估指标](https://xgboost.readthedocs.io/en/latest/tutorials/custom_metric_obj.html) 18 | * [经常问的问题](https://xgboost.readthedocs.io/en/latest/faq.html) 19 | * [XGBoost用户论坛](https://discuss.xgboost.ai/) 20 | * [GPU支持](https://xgboost.readthedocs.io/en/latest/gpu/index.html) 21 | * [XGBoost参数](https://xgboost.readthedocs.io/en/latest/parameter.html) 22 | * [Python包](https://xgboost.readthedocs.io/en/latest/python/index.html) 23 | * [Python包介绍](https://xgboost.readthedocs.io/en/latest/python/python_intro.html) 24 | * [Python API参考](https://xgboost.readthedocs.io/en/latest/python/python_api.html) 25 | * [Python示例](https://github.com/dmlc/xgboost/tree/master/demo/guide-python) 26 | * [R包](https://xgboost.readthedocs.io/en/latest/R-package/index.html) 27 | * [R中的XGBoost简介](https://xgboost.readthedocs.io/en/latest/R-package/xgboostPresentation.html) 28 | * [使用XGBoost了解您的数据集](https://xgboost.readthedocs.io/en/latest/R-package/discoverYourData.html) 29 | * [JVM包](https://xgboost.readthedocs.io/en/latest/jvm/index.html) 30 | * [XGBoost4J入门](https://xgboost.readthedocs.io/en/latest/jvm/java_intro.html) 31 | * [XGBoost4J-Spark教程](https://xgboost.readthedocs.io/en/latest/jvm/xgboost4j_spark_tutorial.html) 32 | * [代码示例](https://github.com/dmlc/xgboost/tree/master/jvm-packages/xgboost4j-example) 33 | * [XGBoost4J Java API](https://xgboost.readthedocs.io/en/latest/jvm/javadocs/index.html) 34 | * [XGBoost4J Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j/index.html) 35 | * [XGBoost4J-Spark Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-spark/index.html) 36 | * [XGBoost4J-Flink Scala API](https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-flink/index.html) 37 | * [Julia包](https://xgboost.readthedocs.io/en/latest/julia.html) 38 | * [CLI界面](https://xgboost.readthedocs.io/en/latest/cli.html) 39 | * [有助于XGBoost](https://xgboost.readthedocs.io/en/latest/contribute.html) -------------------------------------------------------------------------------- /docs/1.md: -------------------------------------------------------------------------------- 1 | # 开始使用 XGBoost 2 | 3 | 这里是一个快速入门的教程, 它展示了让你快速在示例数据集上进行二元分类任务时的 xgboost 的代码片段. 4 | 5 | ## Links to Helpful Other Resources 6 | 7 | * 请参阅 [_安装指南_](../build.html) 以了解如何去安装 xgboost. 8 | * 请参阅 [_入门指引_](../how_to/index.html) 以了解有关使用 xgboost 的各种技巧. 9 | * 请参阅 [_学习教程_](../tutorials/index.html) 以了解有关特定任务的教程. 10 | * 请参阅 [通过例子来学习使用 XGBoost](https://github.com/dmlc/xgboost/tree/master/doc/../demo) 以了解更多代码示例. 11 | 12 | ## Python 13 | 14 | ``` 15 | import xgboost as xgb 16 | # 读取数据 17 | dtrain = xgb.DMatrix('demo/data/agaricus.txt.train') 18 | dtest = xgb.DMatrix('demo/data/agaricus.txt.test') 19 | # 通过 map 指定参数 20 | param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' } 21 | num_round = 2 22 | bst = xgb.train(param, dtrain, num_round) 23 | # 预测 24 | preds = bst.predict(dtest) 25 | 26 | ``` 27 | 28 | ## R 29 | 30 | ``` 31 | # 加载数据 32 | data(agaricus.train, package='xgboost') 33 | data(agaricus.test, package='xgboost') 34 | train <- agaricus.train 35 | test <- agaricus.test 36 | # 拟合模型 37 | bst <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1, nround = 2, 38 | nthread = 2, objective = "binary:logistic") 39 | # 预测 40 | pred <- predict(bst, test$data) 41 | 42 | ``` 43 | 44 | ## Julia 45 | 46 | ``` 47 | using XGBoost 48 | # 读取数据 49 | train_X, train_Y = readlibsvm("demo/data/agaricus.txt.train", (6513, 126)) 50 | test_X, test_Y = readlibsvm("demo/data/agaricus.txt.test", (1611, 126)) 51 | # 拟合模型 52 | num_round = 2 53 | bst = xgboost(train_X, num_round, label=train_Y, eta=1, max_depth=2) 54 | # 预测 55 | pred = predict(bst, test_X) 56 | 57 | ``` 58 | 59 | ## Scala 60 | 61 | ``` 62 | import ml.dmlc.xgboost4j.scala.DMatrix 63 | import ml.dmlc.xgboost4j.scala.XGBoost 64 | 65 | object XGBoostScalaExample { 66 | def main(args: Array[String]) { 67 | // 读取 xgboost/demo/data 目录中可用的训练数据 68 | val trainData = 69 | new DMatrix("/path/to/agaricus.txt.train") 70 | // 定义参数 71 | val paramMap = List( 72 | "eta" -> 0.1, 73 | "max_depth" -> 2, 74 | "objective" -> "binary:logistic").toMap 75 | // 迭代次数 76 | val round = 2 77 | // train the model 78 | val model = XGBoost.train(trainData, paramMap, round) 79 | // 预测 80 | val predTrain = model.predict(trainData) 81 | // 保存模型至文件 82 | model.saveModel("/local/path/to/model") 83 | } 84 | } 85 | 86 | ``` -------------------------------------------------------------------------------- /docs/10.md: -------------------------------------------------------------------------------- 1 | # 为 XGBoost 做贡献 2 | 3 | XGBoost 已经被一群活跃的社区成员开发和使用。 欢迎每个人来做贡献。这是使项目更好,更方便用户使用的一种方法。 4 | 5 | * 当你的补丁被 merged 后,请将您的名字添加到 [CONTRIBUTORS.md](https://github.com/dmlc/xgboost/tree/master/doc/CONTRIBUTORS.md) 。 6 | * 请同时更新 [NEWS.md](https://github.com/dmlc/xgboost/tree/master/doc/NEWS.md) ,以便对 API 的更改添加注释或添加新文档。 7 | 8 | ## 指导方针 9 | 10 | * [提交 Pull Request](#submit-pull-request) 11 | * [Git 工作流程](#git-workflow-howtos) 12 | * [如何解决与 master 的冲突](#how-to-resolve-conflict-with-master) 13 | * [如何将多个提交合并为一个](#how-to-combine-multiple-commits-into-one) 14 | * [force push(强制 push)的后果是什么](#what-is-the-consequence-of-force-push) 15 | * [文档](#document) 16 | * [测试用例](#testcases) 17 | * [例子](#examples) 18 | * [核心库](#core-library) 19 | * [Python 包](#python-package) 20 | * [R 包](#r-package) 21 | 22 | ## 提交 Pull Request 23 | 24 | * 在提交之前,请将您的代码重新与最新版本的 master 上的代码做一次同步(rebase),您可以这么做 25 | 26 | ``` 27 | git remote add upstream https://github.com/dmlc/xgboost 28 | git fetch upstream 29 | git rebase upstream/master 30 | 31 | ``` 32 | 33 | * 如果你有多个小提交,可以将它们 merge 到一起 (使用 git rebase 然后 squash) 成为更有意义的组。 34 | * 发送 pull request! 35 | * 修复自动检查报告的问题 36 | * 如果您正在贡献一个新模块,请考虑在 [tests](https://github.com/dmlc/xgboost/tree/master/doc/tests) 中添加一个测试用例 37 | 38 | ## Git 工作流程 39 | 40 | ### 如何解决与 master 的冲突 41 | 42 | * 首先 rebase 到最新的 master 43 | 44 | ``` 45 | # 做完一次后,可以跳过前两个步骤 46 | git remote add upstream https://github.com/dmlc/xgboost 47 | git fetch upstream 48 | git rebase upstream/master 49 | 50 | ``` 51 | 52 | * git 可能会显示一些它不能合并的冲突,比如说 `conflicted.py` 。 53 | * 手动修改文件以解决冲突。 54 | * 解决冲突后,将其标记为已解决 55 | 56 | ``` 57 | git add conflicted.py 58 | 59 | ``` 60 | 61 | * 那么你可以继续 rebase 通过 62 | 63 | ``` 64 | git rebase --continue 65 | 66 | ``` 67 | 68 | * 最后 push 到你的 fork 上,你可能需要在这里 force push(强制 push)。 69 | 70 | ``` 71 | git push --force 72 | 73 | ``` 74 | 75 | ### 如何将多个提交合并为一个 76 | 77 | 有时候我们想要合并多个 commits(提交),特别是当以后的 commits(提交)只能修复以前的提交时,创建一个有意义的提交集合的 PR 。你可以通过以下步骤来完成。 78 | 79 | * 在此之前,如果您之前没有这样做,请配置 git 的默认编辑器。 80 | 81 | ``` 82 | git config core.editor the-editor-you-like 83 | 84 | ``` 85 | 86 | * 假设我们要 merge 最后 3 个 commits,请输入以下命令 87 | 88 | ``` 89 | git rebase -i HEAD~3 90 | 91 | ``` 92 | 93 | * 它会弹出一个文本编辑器。将第一个 commit 设置为 `pick` ,将后一个 commit 更改为 `squash` 。 94 | * 保存文件之后,会弹出另一个文本编辑器,要求你修改合并的 commit message(提交信息)。 95 | * 将更改 push 到你的 fork ,你需要强制 push(force push)。 96 | 97 | ``` 98 | git push --force 99 | 100 | ``` 101 | 102 | ### force push(强制 push)的后果是什么 103 | 104 | 前两个提示需要强制 push(force push),这是因为我们改变了提交的路径。 只要提交的内容只属于你自己的内容,就可以强制 push 到自己的 fork 。 105 | 106 | ## 文档 107 | 108 | * 该文档是使用 sphinx 和 [recommonmark](http://recommonmark.readthedocs.org/en/latest/) 创建的。 109 | * 你可以在本地构建文档以查看效果。 110 | 111 | ## 测试用例 112 | 113 | * 所有的测试用例在 [tests](https://github.com/dmlc/xgboost/tree/master/doc/tests) 中。 114 | * 我们使用 python nose 进行 python 测试用例。 115 | 116 | ## 示例 117 | 118 | * 用例和示例将在 [demo](https://github.com/dmlc/xgboost/tree/master/doc/demo) 中 119 | * 我们非常高兴听到您的故事,如果您有使用 xgboost 的博客,教程代码解决方案,请告诉我们,我们将在示例页面中添加一个链接。 120 | 121 | ## 核心库 122 | 123 | * 遵循 C++ 的 Google C 的风格。 124 | * 我们使用 doxygen 来记录所有的接口代码。 125 | * 你可以通过输入 `make lint` 来重新产生 linter 。 126 | 127 | ## Python 包 128 | 129 | * 总是将 docstring(文档字符串) 添加到 numpydoc 格式的新函数中。 130 | * 你可以通过输入 `make lint` 来重新生成 linter 。 131 | 132 | ## R 包 133 | 134 | ### 代码风格 135 | 136 | * 我们在 C++ 代码上遵循 Google 的 C++ 风格指南。 137 | * 这主要与项目的其他部分保持一致。 138 | * 另一个原因是我们可以用 linter 自动检查样式。 139 | * 你可以通过在根文件夹中键入以下命令来检查代码的样式。 140 | 141 | ``` 142 | make rcpplint 143 | 144 | ``` 145 | 146 | * 在需要的时候,你可以用 `// NOLINT(*)` 注释来禁用某行的 linter 警告。 147 | 148 | ### Rmarkdown Vignettes 149 | 150 | Rmarkdown vignettes 放置在 [R-package/vignettes](https://github.com/dmlc/xgboost/tree/master/doc/R-package/vignettes) 这些 Rmarkdown 文件不被编译。我们在 [doc/R-package](https://github.com/dmlc/xgboost/tree/master/doc/how_to/R-package) 上托管编译的版本。 151 | 152 | 按照以下步骤添加一个新的 Rmarkdown vignettes: 153 | 154 | * 将原始的 rmarkdown 添加到 `R-package/vignettes` 155 | * 修改 `doc/R-package/Makefile` 来添加要构建的 markdown 文件 156 | * Clone [dmlc/web-data](https://github.com/dmlc/web-data) 仓库到 `doc` 文件夹中 157 | * 现在在 `doc/R-package` 上输入以下命令 158 | 159 | ``` 160 | make the-markdown-to-make.md 161 | 162 | ``` 163 | 164 | * 这将生成 markdown 以及 figure(图形)到 `doc/web-data/xgboost/knitr` 中 165 | * 修改 `doc/R-package/index.md` 来指向生成的 markdown 。 166 | * 将生成的 figure 添加到 `dmlc/web-data` 仓库。 167 | * 如果你已经将 repo clone 到 doc,这意味着一个 `git add` 168 | * 为 markdown 和 `dmlc/web-data` 创建 PR 169 | * 你也可以通过在 `doc` 处输入以下命令在本地生成文档 170 | 171 | ``` 172 | make html 173 | 174 | ``` 175 | 176 | 我们这样做的原因是为了避免由于生成的图像 size 导致 repo 的 size 爆炸。 -------------------------------------------------------------------------------- /docs/11.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | 此文档包含有关 xgboost 的常见问题。 4 | 5 | ## 如何调参 6 | 7 | 参阅 [_参数调整指南_](how_to/param_tuning.html) 8 | 9 | ## 模型的描述 10 | 11 | 参阅 [_介绍 Boosted Trees_](model.html) 12 | 13 | ## 我有一个很大的数据集 14 | 15 | XGBoost 被设计为 memory efficient(高效使用内存)的。通常数据符合你的内存就可以处理问题(这通常意味着数百万个实例)。 如果内存不足,请查看 [外部存储器版本](https://github.com/dmlc/xgboost/tree/master/doc/external_memory.md) 或 xgboost 的 [分布式版本](https://github.com/dmlc/wormhole/tree/master/learn/xgboost) 。 16 | 17 | ## 在平台 X(Hadoop/Yarn, Mesos)上运行 xgboost 18 | 19 | XGBoost 的分布式版本被设计为可移植到各种环境。 分布式 XGBoost 可以移植到任何支持 [rabit](https://github.com/dmlc/rabit) 的平台上。 你可以直接在 Yarn 上运行 xgboost 。理论上 Mesos 和其他资源分配引擎也可以很容易地支持。 20 | 21 | ## 为什么不在 X(Spark, Hadoop)之上实现分布式 xgboost 22 | 23 | 我们需要知道的第一个事实是分布式并不一定能解决所有的问题。 相反,它会产生更多的问题,如更多的通信开销和容错。 最终的问题还是要回到如何推动每个计算节点的限制,并使用更少的资源来完成任务(从而减少通信和失败的机会)。 24 | 25 | 为了实现这些,我们决定在单个节点 xgboost 中重用优化,并在其上构建分布式版本。 机器学习中的通信需求是相当简单的,因为我们可以依赖于一套有限的 API(在我们的案例中)。 这样的设计使我们能够重用大部分代码,同时可以移植到 Hadoop/Yarn, MPI, SGE 等主流平台上。 最重要的是,它推动了我们可以使用的计算资源的限制。 26 | 27 | ## 如何将模型移植到我自己的系统中 28 | 29 | XGBoost 的模型和数据格式是可交换的,这意味着一种语言训练的模型可以加载到另一种语言。 这意味着您可以使用 R 训练模型,同时使用 Java 或 C++ 进行预测,这在生产系统中更为常见。 您还可以使用分布式版本训练模型,并从 Python 加载它们以进行一些交互式分析。 30 | 31 | ## 你支持 LambdaMART 吗 32 | 33 | 是的,xgboost 实现了 LambdaMART 。在 [_参数_](parameter.html) 中可以查看到你想要的部分。 34 | 35 | ## 如何处理缺失值 36 | 37 | xgboost 默认是支持缺失值的。 38 | 39 | ## 运行结果略有不同 40 | 41 | 由于浮点求和顺序和多线程的非确定性,可能会发生这种情况。 虽然一般的准确性通常会保持不变。 -------------------------------------------------------------------------------- /docs/12.md: -------------------------------------------------------------------------------- 1 | # XGBoost Python Package 2 | 3 | 该页面包含软件包上所有与 python 相关的文档链接. 要安装软件包, 请参阅 [_构建和安装说明_](../build.html). 4 | 5 | ## 内容目录 6 | 7 | * [Python 教程概述](python_intro.html) 8 | * [通过例子来学习 XGBoost](https://github.com/apachecn/xgboost-doc-zh/tree/v0.60/demo/zh) 9 | * [Python API 参考](python_api.html) -------------------------------------------------------------------------------- /docs/13.md: -------------------------------------------------------------------------------- 1 | # Python 软件包介绍 2 | 3 | 本文档给出了有关 xgboost python 软件包的基本演练. 4 | 5 | **_其他有用的链接列表_** 6 | 7 | * [Python 演练代码集合](https://github.com/tqchen/xgboost/blob/master/demo/guide-python) 8 | * [Python API 参考](python_api.html) 9 | 10 | ## 安装 XGBoost 11 | 12 | 要安装 XGBoost, 请执行以下步骤: 13 | 14 | * 您需要在项目的根目录下运行 `make` 命令 15 | * 在 `python-package` 目录下运行 16 | 17 | ``` 18 | python setup.py install 19 | 20 | ``` 21 | 22 | ``` 23 | import xgboost as xgb 24 | 25 | ``` 26 | 27 | ## 数据接口 28 | 29 | XGBoost python 模块能够使用以下方式加载数据: 30 | 31 | * libsvm txt format file(libsvm 文本格式的文件) 32 | * Numpy 2D array, and(Numpy 2维数组, 以及) 33 | * xgboost binary buffer file. (xgboost 二进制缓冲文件) 34 | 35 | 这些数据将会被存在一个名为 `DMatrix` 的对象中. 36 | 37 | * 要加载 ligbsvm 文本格式或者 XGBoost 二进制文件到 `DMatrix` 对象中. 代码如下: 38 | 39 | ``` 40 | dtrain = xgb.DMatrix('train.svm.txt') 41 | dtest = xgb.DMatrix('test.svm.buffer') 42 | 43 | ``` 44 | 45 | * 要加载 numpy 的数组到 `DMatrix` 对象中, 代码如下: 46 | 47 | ``` 48 | data = np.random.rand(5,10) # 5 entities, each contains 10 features 49 | label = np.random.randint(2, size=5) # binary target 50 | dtrain = xgb.DMatrix( data, label=label) 51 | 52 | ``` 53 | 54 | * 要加载 scpiy.sparse 数组到 `DMatrix` 对象中, 代码如下: 55 | 56 | ``` 57 | csr = scipy.sparse.csr_matrix((dat, (row, col))) 58 | dtrain = xgb.DMatrix(csr) 59 | 60 | ``` 61 | 62 | * 保存 `DMatrix` 到 XGBoost 二进制文件中后, 会在下次加载时更快: 63 | 64 | ``` 65 | dtrain = xgb.DMatrix('train.svm.txt') 66 | dtrain.save_binary("train.buffer") 67 | 68 | ``` 69 | 70 | * 要处理 `DMatrix` 中的缺失值, 您可以通过指定缺失值的参数来初始化 `DMatrix`: 71 | 72 | ``` 73 | dtrain = xgb.DMatrix(data, label=label, missing = -999.0) 74 | 75 | ``` 76 | 77 | * 在需要时可以设置权重: 78 | 79 | ``` 80 | w = np.random.rand(5, 1) 81 | dtrain = xgb.DMatrix(data, label=label, missing = -999.0, weight=w) 82 | 83 | ``` 84 | 85 | ## 设置参数 86 | 87 | XGBoost 使用 pair 格式的 list 来保存 [_参数_](../parameter.html). 例如: 88 | 89 | * Booster(提升)参数 90 | 91 | ``` 92 | param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' } 93 | param['nthread'] = 4 94 | param['eval_metric'] = 'auc' 95 | 96 | ``` 97 | 98 | * 您也可以指定多个评估的指标: 99 | 100 | ``` 101 | param['eval_metric'] = ['auc', 'ams@0'] 102 | 103 | # alternativly: 104 | # plst = param.items() 105 | # plst += [('eval_metric', 'ams@0')] 106 | 107 | ``` 108 | 109 | * 指定验证集以观察性能 110 | 111 | ``` 112 | evallist = [(dtest,'eval'), (dtrain,'train')] 113 | 114 | ``` 115 | 116 | ## 训练 117 | 118 | 有用参数列表和数据以后, 您现在可以训练一个模型了. 119 | 120 | * 训练 121 | 122 | ``` 123 | num_round = 10 124 | bst = xgb.train( plst, dtrain, num_round, evallist ) 125 | 126 | ``` 127 | 128 | * 保存模型 训练之后,您可以保存模型并将其转储出去. 129 | 130 | ``` 131 | bst.save_model('0001.model') 132 | 133 | ``` 134 | 135 | * 转储模型和特征映射 您可以将模型转储到 txt 文件并查看模型的含义 136 | 137 | ``` 138 | # 转存模型 139 | bst.dump_model('dump.raw.txt') 140 | # 转储模型和特征映射 141 | bst.dump_model('dump.raw.txt','featmap.txt') 142 | 143 | ``` 144 | 145 | * 加载模型 当您保存模型后, 您可以使用如下方式在任何时候加载模型文件 146 | 147 | ``` 148 | bst = xgb.Booster({'nthread':4}) #init model 149 | bst.load_model("model.bin") # load data 150 | 151 | ``` 152 | 153 | ## 提前停止 154 | 155 | 如果您有一个验证集, 你可以使用提前停止找到最佳数量的 boosting rounds(梯度次数). 提前停止至少需要一个 `evals` 集合. 如果有多个, 它将使用最后一个. 156 | 157 | `train(..., evals=evals, early_stopping_rounds=10)` 158 | 159 | 该模型将开始训练, 直到验证得分停止提高为止. 验证错误需要至少每个 `early_stopping_rounds` 减少以继续训练. 160 | 161 | 如果提前停止,模型将有三个额外的字段: `bst.best_score`, `bst.best_iteration` 和 `bst.best_ntree_limit`. 请注意 `train()` 将从上一次迭代中返回一个模型, 而不是最好的一个. 162 | 163 | 这与两个度量标准一起使用以达到最小化(RMSE, 对数损失等)和最大化(MAP, NDCG, AUC). 请注意, 如果您指定多个评估指标, 则 `param ['eval_metric']` 中的最后一个用于提前停止. 164 | 165 | ## 预测 166 | 167 | 当您 训练/加载 一个模型并且准备好数据之后, 即可以开始做预测了. 168 | 169 | ``` 170 | # 7 个样本, 每一个包含 10 个特征 171 | data = np.random.rand(7, 10) 172 | dtest = xgb.DMatrix(data) 173 | ypred = bst.predict(xgmat) 174 | 175 | ``` 176 | 177 | 如果在训练过程中提前停止, 可以用 `bst.best_ntree_limit` 从最佳迭代中获得预测结果: 178 | 179 | ``` 180 | ypred = bst.predict(xgmat,ntree_limit=bst.best_ntree_limit) 181 | 182 | ``` 183 | 184 | ## 绘图 185 | 186 | 您可以使用 plotting(绘图)模块来绘制出 importance(重要性)以及输出的 tree(树). 187 | 188 | 要绘制出 importance(重要性), 可以使用 `plot_importance`. 该函数需要安装 `matplotlib`. 189 | 190 | ``` 191 | xgb.plot_importance(bst) 192 | 193 | ``` 194 | 195 | 输出的 tree(树)会通过 `matplotlib` 来展示, 使用 `plot_tree` 指定 target tree(目标树)的序号. 该函数需要 `graphviz` 和 `matplotlib`. 196 | 197 | ``` 198 | xgb.plot_tree(bst, num_trees=2) 199 | 200 | ``` 201 | 202 | 当您使用 `IPython` 时, 你可以使用 `to_graphviz` 函数, 它可以将 target tree(目标树)转换成 `graphviz` 实例. `graphviz` 实例会自动的在 `IPython` 上呈现. 203 | 204 | ``` 205 | xgb.to_graphviz(bst, num_trees=2) 206 | 207 | ``` -------------------------------------------------------------------------------- /docs/15.md: -------------------------------------------------------------------------------- 1 | # XGBoost 参数 2 | 3 | 在运行 XGBoost 之前, 我们必须设置三种类型的参数: 常规参数, 提升器参数和任务参数. 4 | 5 | * 常规参数与我们用于提升的提升器有关,通常是树模型或线性模型 6 | * 提升器参数取决于你所选择的提升器 7 | * 学习任务的参数决定了学习场景, 例如回归任务可以使用不同的参数进行排序相关的任务 8 | * 命令行参数的行为与 xgboost 的 CLI 版本相关 9 | 10 | ## R 中的参数 11 | 12 | 在 R 包中. 您可以使用 .(点)替换参数中下划线, 例如, 可以使用 max.depth 作为 max_depth. 下划线参数在 R 中也是有效的. 13 | 14 | ## 常规参数 15 | 16 | * booster [default=gbtree] 17 | * which booster to use, can be gbtree, gblinear or dart. gbtree and dart use tree based model while gblinear uses linear function. 18 | * silent [default=0] 19 | * 0 means printing running messages, 1 means silent mode. 20 | * nthread [default to maximum number of threads available if not set] 21 | * number of parallel threads used to run xgboost 22 | * num_pbuffer [set automatically by xgboost, no need to be set by user] 23 | * size of prediction buffer, normally set to number of training instances. The buffers are used to save the prediction results of last boosting step. 24 | * num_feature [set automatically by xgboost, no need to be set by user] 25 | * feature dimension used in boosting, set to maximum dimension of the feature 26 | 27 | ## 用于 Tree 提升的参数 28 | 29 | * eta [default=0.3] 30 | * step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new features. and eta actually shrinks the feature weights to make the boosting process more conservative. 31 | * range: [0,1] 32 | * gamma [default=0] 33 | * minimum loss reduction required to make a further partition on a leaf node of the tree. the larger, the more conservative the algorithm will be. 34 | * range: [0,∞] 35 | * max_depth [default=6] 36 | * maximum depth of a tree, increase this value will make model more complex / likely to be overfitting. 37 | * range: [1,∞] 38 | * min_child_weight [default=1] 39 | * minimum sum of instance weight(hessian) needed in a child. If the tree partition step results in a leaf node with the sum of instance weight less than min_child_weight, then the building process will give up further partitioning. In linear regression mode, this simply corresponds to minimum number of instances needed to be in each node. The larger, the more conservative the algorithm will be. 40 | * range: [0,∞] 41 | * max_delta_step [default=0] 42 | * Maximum delta step we allow each tree’s weight estimation to be. If the value is set to 0, it means there is no constraint. If it is set to a positive value, it can help making the update step more conservative. Usually this parameter is not needed, but it might help in logistic regression when class is extremely imbalanced. Set it to value of 1-10 might help control the update 43 | * range: [0,∞] 44 | * subsample [default=1] 45 | * subsample ratio of the training instance. Setting it to 0.5 means that XGBoost randomly collected half of the data instances to grow trees and this will prevent overfitting. 46 | * range: (0,1] 47 | * colsample_bytree [default=1] 48 | * subsample ratio of columns when constructing each tree. 49 | * range: (0,1] 50 | * colsample_bylevel [default=1] 51 | * subsample ratio of columns for each split, in each level. 52 | * range: (0,1] 53 | * lambda [default=1] 54 | * L2 regularization term on weights, increase this value will make model more conservative. 55 | * alpha [default=0] 56 | * L1 regularization term on weights, increase this value will make model more conservative. 57 | * tree_method, string [default=’auto’] 58 | * The tree constructtion algorithm used in XGBoost(see description in the [reference paper](http://arxiv.org/abs/1603.02754)) 59 | * Distributed and external memory version only support approximate algorithm. 60 | * Choices: {‘auto’, ‘exact’, ‘approx’} 61 | * ‘auto’: Use heuristic to choose faster one. 62 | * For small to medium dataset, exact greedy will be used. 63 | * For very large-dataset, approximate algorithm will be choosed. 64 | * Because old behavior is always use exact greedy in single machine, user will get a message when approximate algorithm is choosed to notify this choice. 65 | * ‘exact’: Exact greedy algorithm. 66 | * ‘approx’: Approximate greedy algorithm using sketching and histogram. 67 | * sketch_eps, [default=0.03] 68 | * This is only used for approximate greedy algorithm. 69 | * This roughly translated into `O(1 / sketch_eps)` number of bins. Compared to directly select number of bins, this comes with theoretical ganrantee with sketch accuracy. 70 | * Usuaully user do not have to tune this. but consider set to lower number for more accurate enumeration. 71 | * range: (0, 1) 72 | * scale_pos_weight, [default=0] 73 | * Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases) See [_Parameters Tuning_](how_to/param_tuning.html) for more discussion. Also see Higgs Kaggle competition demo for examples: [R](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-train.R), [py1](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-numpy.py), [py2](https://github.com/dmlc/xgboost/tree/master/doc/../demo/kaggle-higgs/higgs-cv.py), [py3](https://github.com/dmlc/xgboost/tree/master/doc/../demo/guide-python/cross_validation.py) 74 | 75 | ## 用于 Dart Booster 的其它参数 76 | 77 | * sample_type [default=”uniform”] 78 | * type of sampling algorithm. 79 | * “uniform”: dropped trees are selected uniformly. 80 | * “weighted”: dropped trees are selected in proportion to weight. 81 | * normalize_type [default=”tree”] 82 | * type of normalization algorithm. 83 | * “tree”: new trees have the same weight of each of dropped trees. 84 | * weight of new trees are 1 / (k + learnig_rate) 85 | * dropped trees are scaled by a factor of k / (k + learning_rate) 86 | * “forest”: new trees have the same weight of sum of dropped trees (forest). 87 | * weight of new trees are 1 / (1 + learning_rate) 88 | * dropped trees are scaled by a factor of 1 / (1 + learning_rate) 89 | * rate_drop [default=0.0] 90 | * dropout rate. 91 | * range: [0.0, 1.0] 92 | * skip_drop [default=0.0] 93 | * probability of skip dropout. 94 | * If a dropout is skipped, new trees are added in the same manner as gbtree. 95 | * range: [0.0, 1.0] 96 | 97 | ## 用于 Linear Booster 的参数 98 | 99 | * lambda [default=0] 100 | * L2 regularization term on weights, increase this value will make model more conservative. 101 | * alpha [default=0] 102 | * L1 regularization term on weights, increase this value will make model more conservative. 103 | * lambda_bias 104 | * L2 regularization term on bias, default 0(no L1 reg on bias because it is not important) 105 | 106 | ## 学习任务的参数 107 | 108 | Specify the learning task and the corresponding learning objective. The objective options are below: 109 | 110 | * objective [ default=reg:linear ] 111 | 112 | * “reg:linear” –linear regression 113 | * “reg:logistic” –logistic regression 114 | * “binary:logistic” –logistic regression for binary classification, output probability 115 | * “binary:logitraw” –logistic regression for binary classification, output score before logistic transformation 116 | * “count:poisson” –poisson regression for count data, output mean of poisson distribution 117 | * max_delta_step is set to 0.7 by default in poisson regression (used to safeguard optimization) 118 | * “multi:softmax” –set XGBoost to do multiclass classification using the softmax objective, you also need to set num_class(number of classes) 119 | * “multi:softprob” –same as softmax, but output a vector of ndata * nclass, which can be further reshaped to ndata, nclass matrix. The result contains predicted probability of each data point belonging to each class. 120 | * “rank:pairwise” –set XGBoost to do ranking task by minimizing the pairwise loss 121 | * “reg:gamma” –gamma regression for severity data, output mean of gamma distribution 122 | 123 | * base_score [ default=0.5 ] 124 | * the initial prediction score of all instances, global bias 125 | * for sufficent number of iterations, changing this value will not have too much effect. 126 | * eval_metric [ default according to objective ] 127 | * evaluation metrics for validation data, a default metric will be assigned according to objective( rmse for regression, and error for classification, mean average precision for ranking ) 128 | * User can add multiple evaluation metrics, for python user, remember to pass the metrics in as list of parameters pairs instead of map, so that latter ‘eval_metric’ won’t override previous one 129 | * The choices are listed below: 130 | * “rmse”: [root mean square error](http://en.wikipedia.org/wiki/Root_mean_square_error) 131 | * “mae”: [mean absolute error](https://en.wikipedia.org/wiki/Mean_absolute_error) 132 | * “logloss”: negative [log-likelihood](http://en.wikipedia.org/wiki/Log-likelihood) 133 | * “error”: Binary classification error rate. It is calculated as #(wrong cases)/#(all cases). For the predictions, the evaluation will regard the instances with prediction value larger than 0.5 as positive instances, and the others as negative instances. 134 | * “merror”: Multiclass classification error rate. It is calculated as #(wrong cases)/#(all cases). 135 | * “mlogloss”: [Multiclass logloss](https://www.kaggle.com/wiki/MultiClassLogLoss) 136 | * “auc”: [Area under the curve](http://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_curve) for ranking evaluation. 137 | * “ndcg”:[Normalized Discounted Cumulative Gain](http://en.wikipedia.org/wiki/NDCG) 138 | * “map”:[Mean average precision](http://en.wikipedia.org/wiki/Mean_average_precision#Mean_average_precision) 139 | * “ndcg@n”,”map@n”: n can be assigned as an integer to cut off the top positions in the lists for evaluation. 140 | * “ndcg-”,”map-”,”ndcg@n-”,”map@n-”: In XGBoost, NDCG and MAP will evaluate the score of a list without any positive samples as 1\. By adding “-” in the evaluation metric XGBoost will evaluate these score as 0 to be consistent under some conditions. training repeatively 141 | * “gamma-deviance”: [residual deviance for gamma regression] 142 | * seed [ default=0 ] 143 | 144 | * random number seed. 145 | 146 | ## 命令行参数 147 | 148 | The following parameters are only used in the console version of xgboost 149 | 150 | * use_buffer [ default=1 ] 151 | 152 | * Whether to create a binary buffer from text input. Doing so normally will speed up loading times 153 | 154 | * num_round 155 | 156 | * The number of rounds for boosting 157 | 158 | * data 159 | * The path of training data 160 | * test:data 161 | * The path of test data to do prediction 162 | * save_period [default=0] 163 | 164 | * the period to save the model, setting save_period=10 means that for every 10 rounds XGBoost will save the model, setting it to 0 means not save any model during training. 165 | 166 | * task [default=train] options: train, pred, eval, dump 167 | * train: training using data 168 | * pred: making prediction for test:data 169 | * eval: for evaluating statistics specified by eval[name]=filename 170 | * dump: for dump the learned model into text format(preliminary) 171 | * model_in [default=NULL] 172 | * path to input model, needed for test, eval, dump, if it is specified in training, xgboost will continue training from the input model 173 | * model_out [default=NULL] 174 | * path to output model after training finishes, if not specified, will output like 0003.model where 0003 is number of rounds to do boosting. 175 | * model_dir [default=models] 176 | * The output directory of the saved models during training 177 | * fmap 178 | * feature map, used for dump model 179 | * name_dump [default=dump.txt] 180 | * name of model dump file 181 | * name_pred [default=pred.txt] 182 | * name of prediction file, used in pred mode 183 | * pred_margin [default=0] 184 | * predict margin instead of transformed probability -------------------------------------------------------------------------------- /docs/2.md: -------------------------------------------------------------------------------- 1 | # XGBoost 教程 2 | 3 | 本节包含 XGBoost 包中的官方教程。 参阅 [Awesome XGBoost](https://github.com/dmlc/xgboost/tree/master/demo) 找到更多的资源。 4 | 5 | ## 目录 6 | 7 | * [Boosted Trees 介绍](../model.html) 8 | * [在 AWS 上的分布式 XGBoost YARN](aws_yarn.html) 9 | * [DART booster](dart.html) -------------------------------------------------------------------------------- /docs/3.md: -------------------------------------------------------------------------------- 1 | # Boosted Trees 介绍 2 | 3 | XGBoost 是 “Extreme Gradient Boosting” 的缩写,其中 “Gradient Boosting” 一词在论文 _Greedy Function Approximation: A Gradient Boosting Machine_ 中,由 Friedman 提出。 XGBoost 基于这个原始模型。 这是 gradient boosted trees(梯度增强树)的教程,大部分内容是基于 xgboost 的作者的这些 [slides](http://homes.cs.washington.edu/~tqchen/pdf/BoostedTree.pdf) 。 4 | 5 | GBM (boosted trees,增强树)已经有一段时间了,关于这个话题有很多的材料。 这个教程试图用监督学习的元素以独立和有原则的方式解释 boosted trees (增强树)。 我们认为这个解释更加清晰,更加正式,并激发了 xgboost 中使用的变体。 6 | 7 | ## 监督学习的要素 8 | 9 | XGBoost 用于监督学习问题,我们使用训练数据 ![](img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg) 来预测目标变量 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 。 在我们深入了解 boosted trees 之前,首先回顾一下监督学习的重要组成部件。 10 | 11 | ### 模型和参数 12 | 13 | 监督学习中的 **_model(模型)_** 通常是指给定输入 ![](img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg) 如何去预测输出 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 的数学结构。 例如,一个常见的模型是一个 _linear model(线性模型)_(如线性回归和 logistic regression),其中的预测是由 ![](img/0.72/7d80469ba9822a0d05b7140b4ca0290a.jpg) 给出的,这是加权输入特征的线性组合(线性叠加的方式)。 其实这里的预测 ![](img/0.72/4028c0134b3b847f0e97b4cd284bc927.jpg) 可以有不同的解释,取决于做的任务。 例如,我们可以通过 logistic 转换得到 logistic regression 中 positive 类别的概率,当我们想要对输出结果排序的时候,也可以作为排序得分指标等。 14 | 15 | **_parameters(参数)_** 是我们需要从数据中学习的未确定部分。在线性回归问题中,参数是系数 ![](img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg) 。 通常我们使用 ![](img/0.72/87142829e4107d70b9cae3f8b2d095fc.jpg) 来表示参数。 16 | 17 | ### 目标函数:训练损失 + 正则 18 | 19 | 基于对 ![](img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg) 的不同理解,我们可以得到不同的问题,比如回归,分类,排序等。 我们需要找到一种方法来找到训练数据的最佳参数。为了做到这一点,我们需要定义一个所谓的 **_objective function(目标函数)_** 以给定一组参数来衡量模型的性能。 20 | 21 | 关于目标函数的一个非常重要的事实是,它们 **_must always(必须总是)_** 包含两个部分:training loss (训练损失) 和 regularization(正则化)。 22 | 23 | ![](img/0.72/f9a24042b2fe37eb28c8462d0195c985.jpg) 24 | 25 | 其中 ![](img/0.72/dd45717d5b8500473d4d5cc5e8da2d43.jpg) 是训练损失函数, ![](img/0.72/94f79ae2273f820cc565fdebf14a9f63.jpg) 是正则化项。 training loss (训练损失)衡量我们的数据对训练数据的预测性。 例如,常用的训练损失是 mean squared error(均方误差,MSE)。 26 | 27 | ![](img/0.72/1d3fcd8d09d65c0ee710f95bf8422ad9.jpg) 28 | 29 | 另一个常用的损失函数是 logistic 回归的 logistic 损失。 30 | 31 | ![](img/0.72/0507a5548594983588fdc7c98687b36b.jpg) 32 | 33 | **_regularization term(正则化项)_** 是人们通常忘记添加的内容。正则化项控制模型的复杂性,这有助于避免过拟合。 这听起来有些抽象,那么我们在下面的图片中考虑下面的问题。在图像左上角给出输入数据点的情况下,要求您在视觉上 _fit(拟合)_ 一个 step function(阶梯函数)。 您认为三种中的哪一种解决方案是最拟合效果最好的? 34 | 35 | ![Step function](img/0.72/2d3bec80be56303ea525a39cd4395d5c.jpg) 36 | 37 | 答案已经标注为红色了。请思考一下这个是否在你的视觉上较为合理?总的原则是我们想要一个 **_simple(简单)_** 和 **_predictive(可预测)_** 的模型。 两者之间的权衡也被称为机器学习中的 bias-variance tradeoff(偏差-方差 权衡)。 38 | 39 | 对于线性模型常见的正则化项有 ![](img/0.72/c9379d9b2e521341735b00d845051d04.jpg) 正则和 ![](img/0.72/ff439882e70c47df87d58c837a372490.jpg) 正则。这样的目标函数的设计来自于统计学习中的一个重要概念,也是我们刚才说的, bias-variance tradeoff(偏差-方差 权衡)。比较感性的理解, Bias 可以理解为假设我们有无限多数据的时候,可以训练出最好的模型所拿到的误差。而 Variance 是因为我们只有有限数据,其中随机性带来的误差。目标中误差函数鼓励我们的模型尽可能去拟合训练数据,这样相对来说最后的模型会有比较小的 bias 。而正则化项则鼓励更加简单的模型。因为当模型简单之后,有限数据拟合出来结果的随机性比较小,不容易过拟合,使得最后模型的预测更加稳定。 40 | 41 | ### 为什么要介绍 general principle(一般原则) 42 | 43 | 上面介绍的要素构成了监督学习的基本要素,它们自然是机器学习工具包的基石。 例如,你应该能够描述 boosted trees 和 random forests 之间的差异和共同点。 以正式的方式理解这个过程也有助于我们理解我们正在学习的目标以及启发式算法背后的原因,例如 pruning 和 smoothing 。 44 | 45 | ## tree ensembles(树集成) 46 | 47 | 既然我们已经介绍了监督学习的内容,那么接下来让我们开始介绍真正的 trees 吧。 首先,让我们先来了解一下 xgboost 的 **_model(模型)_** : tree ensembles(树集成)。 树集成模型是一组 classification and regression trees (CART)。 下面是一个 CART 的简单的示例,它可以分类是否有人喜欢电脑游戏。 48 | 49 | ![CART](img/0.72/1476c1e968148d38644efcce09c2bef4.jpg) 50 | 51 | 我们把一个家庭的成员分成不同的叶子,并把他们分配到相应的叶子节点上。 CART 与 decision trees(决策树)有些许的不同,就是叶子只包含决策值。在 CART 中,每个叶子都有一个 real score (真实的分数),这给了我们更丰富的解释,超越了分类。 这也使得统一的优化步骤更容易,我们将在本教程的后面部分看到。 52 | 53 | 通常情况下,单棵树由于过于简单而不够强大到可以支持在实践中使用的。实际使用的是所谓的 tree ensemble model(树集成模型),它将多棵树的预测加到一起。 54 | 55 | ![TwoCART](img/0.72/35b6f55e2b5953ff94ee568f744b4efb.jpg) 56 | 57 | 上图是两棵树的集成的例子。将每棵树的预测分数加起来得到最终分数。 如果你看一下这个例子,一个重要的事实就是两棵树互相 _complement(补充)_ 。 在数学表示上,我们可以在表单中编写我们的模型。 58 | 59 | ![](img/0.72/8a5adca27b799741caabbdeae20be5cf.jpg) 60 | 61 | 其中 ![](img/0.72/ce9bf02722174f83b83dc21985022455.jpg) 是树的数量, ![](img/0.72/a96052742f7423a92cfcad03a185fa63.jpg) 是函数空间 ![](img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg) 的函数, ![](img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg) 是所有可能的 CARTs 的集合。所以我们优化的目标可以写成 62 | 63 | ![](img/0.72/b999689ef453cce06ffd631a571e1f29.jpg) 64 | 65 | 那么问题来了,random forests(随机森林)的 _model(模型)_ 是什么?这正是 tree ensembles(树集成)!所以 random forests 和 boosted trees 在模型上并没有什么不同,不同之处在于我们如何训练它们。这意味着如果你写一个 tree ensembles(树集成)的预测服务,你只需要编写它们中的一个,它们应该直接为 random forests(随机森林)和 boosted trees(增强树)工作。这也是监督学习基石元素的一个例子。 66 | 67 | ## Tree Boosting 68 | 69 | 在介绍完模型之后,我们从真正的训练部分开始。我们应该怎么学习 trees 呢? 答案是,对于所有的监督学习模型都一样的处理:_定义一个合理的目标函数,然后去尝试优化它_! 70 | 71 | 假设我们有以下目标函数(记住它总是需要包含训练损失和正则化) 72 | 73 | ![](img/0.72/4dc70a02830b485f3f26015c8fb1fdb9.jpg) 74 | 75 | ### 附加训练 76 | 77 | 我们想要问的第一件事就是树的 **_parameters(参数)_** 是什么。 你可能已经发现了,我们要学习的是那些函数 ![](img/0.72/0d22e8726e5829598054d2585d7c9370.jpg) ,每个函数都包含树的结构和叶子分数。这比传统的你可以找到捷径的优化问题要难得多。在 tree ensemble 中,参数对应了树的结构,以及每个叶子节点上面的预测分数。 一次性训练所有的树并不容易。 相反,我们使用一个附加的策略:优化好我们已经学习完成的树,然后一次添加一棵新的树。 我们通过 ![](img/0.72/17131c421b074dc314397e82a4528438.jpg) 来关注步骤 ![](img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg) 的预测值,所以我们有 78 | 79 | ![](img/0.72/09858ff3ca719faf578ad5b13b3c98fa.jpg) 80 | 81 | 另外还有一个问题,每一步我们想要哪棵 tree 呢?一个自然而然的事情就是添加一个优化我们目标的方法。 82 | 83 | ![](img/0.72/1fe2cf4fb357117e177388becb68d9f9.jpg) 84 | 85 | 如果我们考虑使用 MSE 作为我们的损失函数,它将是下面的形式。 86 | 87 | ![](img/0.72/25bce8f7365849fcbccf06c572280bfd.jpg) 88 | 89 | MSE 的形式比较友好,具有一阶项(通常称为残差)和二次项。 对于其他形式的损失(例如,logistic loss),获得这么好的形式并不是那么容易。 所以在一般情况下,我们把损失函数的泰勒展开到二阶 90 | 91 | ![](img/0.72/8c50b9fb6c2c85cbc672ab618d01c39b.jpg) 92 | 93 | 其中 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 被定义为 94 | 95 | ![](img/0.72/77116c2aaf28d1d862f8095806911151.jpg) 96 | 97 | 我们删除了所有的常量之后, ![](img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg) 步骤中的具体目标就变成了 98 | 99 | ![](img/0.72/b201e8f1610bd6f5f4a4799b885df578.jpg) 100 | 101 | 这成为了新树的优化目标。这个定义的一个重要优点是它只依赖于 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 。这就是 xgboost 如何支持自定义损失函数。 我们可以使用完全相同的使用 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) 作为输入的 solver(求解器)来对每个损失函数进行优化,包括 logistic regression, weighted logistic regression。 102 | 103 | ### 模型复杂度 104 | 105 | 我们已经介绍了训练步骤,但是等等,还有一个重要的事情,那就是 **_regularization(正则化)_** ! 我们需要定义树的复杂度 ![](img/0.72/683c9a76e2b8489a4a3d0ffdec2ad441.jpg) 。为了做到这一点,让我们首先改进一棵树的定义 ![](img/0.72/98b4f83629c037523fd162ed4b216f51.jpg) 如下 106 | 107 | ![](img/0.72/11710d80af8ff3712f529745adf5409a.jpg) 108 | 109 | 这里 ![](img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg) 是树叶上的分数向量,![](img/0.72/ab0e7d4ab7d7b6e0a5aa4383fcdd2ee5.jpg) 是将每个数据点分配给叶子的函数,![](img/0.72/907939506800cf89ad2ed0d2d05cfabc.jpg) 是树叶的数量。 在 XGBoost 中,我们将复杂度定义为 110 | 111 | ![](img/0.72/aa297e24fc75c747a07b290638760b43.jpg) 112 | 113 | 当然有不止一种方法来定义复杂度,但是这个具体的方法在实践中运行良好。正则化是大多数树的包不那么谨慎或简单忽略的一部分。这是因为对传统的树学习算法的对待只强调提高 impurity(不纯性),而复杂度控制则是启发式的。 通过正式定义,我们可以更好地了解我们正在学习什么,是的,它在实践中运行良好。 114 | 115 | ### The Structure Score(结构分数) 116 | 117 | 这是 derivation(派生)的神奇部分。在对树模型进行重新格式化之后,我们可以用第 ![](img/0.72/8e83474bbce57dfc2d0399adceb655b3.jpg) 棵树来编写目标值如 : 118 | 119 | ![](img/0.72/2c05306f7baa0066128b8f8afd95ec37.jpg) 120 | 121 | 其中 ![](img/0.72/4ef880d0d67e58f282ce4ed79d4f9549.jpg) 是分配给第 ![](img/0.72/d9d5f5978eda3e268a05e689f897c9c6.jpg) 个叶子的数据点的索引的集合。 请注意,在第二行中,我们更改了总和的索引,因为同一叶上的所有数据点都得到了相同的分数。 我们可以通过定义 ![](img/0.72/2c864507ad886978650e8f67f3224afe.jpg) 和 ![](img/0.72/51b7cc80809f3eada5745a2e5f79b18d.jpg) 来进一步压缩表达式 : 122 | 123 | ![](img/0.72/4330c12a952e7f831231b51700bcd390.jpg) 124 | 125 | 在这个等式中 ![](img/0.72/af220a242098880c9f5524587fac68c5.jpg) 是相互独立的,形式 ![](img/0.72/ad3e76b49257d997698faa2d585c2a0a.jpg) 是二次的,对于给定的结构 ![](img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg) 的最好的 ![](img/0.72/af220a242098880c9f5524587fac68c5.jpg),我们可以得到最好的客观规约: 126 | 127 | ![](img/0.72/560afea477f6995994b0cfff8262e34d.jpg) 128 | 129 | 最后一个方程度量一个树结构 ![](img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg) **_how good(到底有多好)_** 。 130 | 131 | ![Structure Score](img/0.72/4194e8522c4e867f714b492a4439dae8.jpg) 132 | 133 | 如果这一切听起来有些复杂,我们来看一下图片,看看分数是如何计算的。 基本上,对于一个给定的树结构,我们把统计 ![](img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg) 和 ![](img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg) push 到它们所属的叶子上,统计数据加和到一起,然后使用公式计算树是多好。 除了考虑到模型的复杂度,这个分数就像决策树中的杂质测量一样(例如,熵/GINI系数)。 134 | 135 | ### 学习树结构 136 | 137 | 既然我们有了一个方法来衡量一棵树有多好,理想情况下我们会列举所有可能的树并挑选出最好的树。 在实践中,这种方法是比较棘手的,所以我们会尽量一次优化树的一个层次。 具体来说,我们试图将一片叶子分成两片,并得到分数 138 | 139 | ![](img/0.72/b8afcf3f3647596ed0584af454f840a9.jpg) 140 | 141 | 这个公式可以分解为 1) 新左叶上的得分 2) 新右叶上的得分 3) 原始叶子上的得分 4) additional leaf(附加叶子)上的正则化。 我们可以在这里看到一个重要的事实:如果增益小于 ![](img/0.72/cdab9437b701fd21fb3294cfba7c4bc2.jpg),我们最好不要添加那个分支。这正是基于树模型的 **_pruning(剪枝)_** 技术!通过使用监督学习的原则,我们自然会想出这些技术工作的原因 :) 142 | 143 | 对于真实有价值的数据,我们通常要寻找一个最佳的分割。为了有效地做到这一点,我们把所有的实例按照排序顺序排列,如下图所示。 ![Best split](img/0.72/728afccdae39c1bac6479386dab442e8.jpg) 144 | 145 | 然后从左到右的扫描就足以计算所有可能的拆分解决方案的结构得分,我们可以有效地找到最佳的拆分。 146 | 147 | ## XGBoost 最后的话 148 | 149 | 既然你明白了什么是 boosted trees 了,你可能会问这在 [XGBoost](https://github.com/dmlc/xgboost) 中的介绍在哪里? XGBoost 恰好是本教程中引入的正式原则的动力! 更重要的是,在 **_systems optimization(系统优化)_** 和 **_principles in machine learning(机器学习原理)_** 方面都有深入的研究。 这个库的目标是推动机器计算极限的极端,以提供一个 **_scalable(可扩展)_**, **_portable(可移植)_** 和 **_accurate(精确的)_** 库。 确保你 [试一试](https://github.com/dmlc/xgboost),最重要的是,向社区贡献你的智慧(代码,例子,教程)! -------------------------------------------------------------------------------- /docs/4.md: -------------------------------------------------------------------------------- 1 | # AWS 上的分布式 XGBoost YARN 2 | 3 | 这是关于如何在 AWS EC2 集群上设置和运行分布式 [XGBoost](https://github.com/dmlc/xgboost) 的分步教程。分布式 XGBoost 运行在各种平台上,如 MPI, SGE 和 Hadoop YARN 。 在本教程中,我们使用 YARN 作为示例,因为这是分布式计算广泛使用的解决方案。 4 | 5 | ## 准备条件 6 | 7 | 我们需要获得一个 [AWS key-pair(密钥对)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) 来访问 AWS 服务。我们假设我们正在使用一个 `mykey` 的 key(键)和相应的权限文件 `mypem.pem` 。 8 | 9 | 我们还需要 [AWS credentials](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html),其中包括 `ACCESS_KEY_ID` 和 `SECRET_ACCESS_KEY` 。 10 | 11 | 最后,我们需要一个 S3 bucket(桶)来托管数据和模型, `s3://mybucket/` 12 | 13 | ## 设置 Hadoop YARN 集群 14 | 15 | 本节将介绍如何从头开始部署 Hadoop YARN 集群。 如果你已经有一个部署好的 Hadoop YARN 集群,那么你可以直接跳过这一步。 我们将使用 [yarn-ec2](https://github.com/tqchen/yarn-ec2) 来启动集群。 16 | 17 | 我们可以先使用下面的命令来 clone yarn-ec2 脚本 18 | 19 | ``` 20 | git clone https://github.com/tqchen/yarn-ec2 21 | 22 | ``` 23 | 24 | 要使用该脚本,我们必须将环境变量 `AWS_ACCESS_KEY_ID` 和 `AWS_SECRET_ACCESS_KEY` 设置正确。这可以通过在 `~/.bashrc` 中添加以下两行来完成(用正确的替换字符串) 25 | 26 | ``` 27 | export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE 28 | export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 29 | 30 | ``` 31 | 32 | 现在我们可以从 EC2 启动集群的 master 了 33 | 34 | ``` 35 | ./yarn-ec2 -k mykey -i mypem.pem launch xgboost 36 | 37 | ``` 38 | 39 | 等待几分钟,直到 master 启动完成。 40 | 41 | master 机器启动之后,可以使用以下命令查询 master 机器的公共 DNS 。 42 | 43 | ``` 44 | ./yarn-ec2 -k mykey -i mypem.pem get-master xgboost 45 | 46 | ``` 47 | 48 | 它会显示 master 机器的公共 DNS 就像下面这样 `ec2-xx-xx-xx.us-west-2.compute.amazonaws.com` 现在我们可以打开浏览器,输入(用 master DNS 替换 DNS) 49 | 50 | ``` 51 | ec2-xx-xx-xx.us-west-2.compute.amazonaws.com:8088 52 | 53 | ``` 54 | 55 | 这将显示 YARN 集群的 job tracker 。需要注意的是,在 master 完成引导和启动 job tracker 之前我们可能需要等待几分钟。 56 | 57 | 在 master 机器启动后,我们可以自由添加更多的 slave 机器到集群中。 以下的命令将 m3.xlarge 实例添加到集群中了。 58 | 59 | ``` 60 | ./yarn-ec2 -k mykey -i mypem.pem -t m3.xlarge -s 2 addslave xgboost 61 | 62 | ``` 63 | 64 | 我们也可以选择添加两个 spot 实例 65 | 66 | ``` 67 | ./yarn-ec2 -k mykey -i mypem.pem -t m3.xlarge -s 2 addspot xgboost 68 | 69 | ``` 70 | 71 | slave 机器将启动,引导并向 master 报告。 你可以单击 job tracker 上的 Nodes 链接来检查 slave 机器是否已连接。 或者只需输入以下 URL(将 DNS 替换为 master DNS) 72 | 73 | ``` 74 | ec2-xx-xx-xx.us-west-2.compute.amazonaws.com:8088/cluster/nodes 75 | 76 | ``` 77 | 78 | 我们需要注意的一件事情是,并不是 job tracker 中的所有的链接都会起作用。 这是由于它们中的许多使用 AWS 的私有 IP,只能由 EC2 访问。 我们可以使用 ssh 代理来访问这些包。 现在我们已经建立了一个 master 和两个 slaves 的集群。我们准备好运行这个实验。 79 | 80 | ## 使用 S3 构建 XGBoost 81 | 82 | 我们可以通过以下命令登录到 master 服务器上。 83 | 84 | ``` 85 | ./yarn-ec2 -k mykey -i mypem.pem login xgboost 86 | 87 | ``` 88 | 89 | 我们将使用 S3 来托管数据和结果模型,因此在集群关闭后数据不会丢失。 要做到这一点,我们需要构建 S3 支持的 xgboost 。我们唯一需要做的就是设置 `USE_S3` 变量为 true 。这可以通过以下的命令来实现。 90 | 91 | ``` 92 | git clone --recursive https://github.com/dmlc/xgboost 93 | cd xgboost 94 | cp make/config.mk config.mk 95 | echo "USE_S3=1" >> config.mk 96 | make -j4 97 | 98 | ``` 99 | 100 | 现在我们已经构建了 S3 支持的 XGBoost 。如果您打算在 HDFS 上存储数据,您也可以启用 HDFS 支持,只需要打开 `USE_HDFS` 就可以了。 101 | 102 | XGBoost 也依赖环境变量来访问 S3,所以你需要在 `~/.bashrc` 中添加以下两行(用正确的字符串替换)在 master 机器上也是如此。 103 | 104 | ``` 105 | export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE 106 | export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 107 | export BUCKET=mybucket 108 | 109 | ``` 110 | 111 | ## 在 S3 上托管数据 112 | 113 | 在这个例子中,我们将把 xgboost 中的示例数据集复制到 S3 bucket(存储桶)中作为输入。 在正常使用情况下,数据集通常是从 existing distributed processing pipeline (现有的分布式处理 pipeline)创建的。 我们可以使用 [s3cmd](http://s3tools.org/s3cmd) 将数据复制到 mybucket(用真实的 bucket 名称替换 ${BUCKET}) 。 114 | 115 | ``` 116 | cd xgboost 117 | s3cmd put demo/data/agaricus.txt.train s3://${BUCKET}/xgb-demo/train/ 118 | s3cmd put demo/data/agaricus.txt.test s3://${BUCKET}/xgb-demo/test/ 119 | 120 | ``` 121 | 122 | ## 提交作业 123 | 124 | 现在一切准备就绪,我们可以将 xgboost 分布式作业提交到 YARN 集群了。 我们将使用 [dmlc-submit](https://github.com/dmlc/dmlc-core/tree/master/tracker) 脚本来提交作业。 125 | 126 | 现在我们可以在 distributed training folder(分布式训练文件夹)(用真实的 bucket 名称替换 ${BUCKET}) 中运行以下脚本。 127 | 128 | ``` 129 | cd xgboost/demo/distributed-training 130 | # Use dmlc-submit to submit the job. 131 | ../../dmlc-core/tracker/dmlc-submit --cluster=yarn --num-workers=2 --worker-cores=2\ 132 | ../../xgboost mushroom.aws.conf nthread=2\ 133 | data=s3://${BUCKET}/xgb-demo/train\ 134 | eval[test]=s3://${BUCKET}/xgb-demo/test\ 135 | model_dir=s3://${BUCKET}/xgb-demo/model 136 | 137 | ``` 138 | 139 | 所有配置如 `data` 和 `model_dir` 也可以直接写入配置文件。 请注意,我们只指定文件的文件夹路径,而不是文件名。 XGBoost 将读取该文件夹下的所有文件作为训练和评估数据。 140 | 141 | 在这个命令中,我们使用了 2 个 workers,每个 worker 使用两个正在运行的线程。 XGBoost 可以从每个 worker 使用多个 cores 中受益。 工作 cores 的常见的选择范围从 4 到 8 。 训练好的模型将被保存到指定的模型文件夹中。您可以浏览模型文件夹。 142 | 143 | ``` 144 | s3cmd ls s3://${BUCKET}/xgb-demo/model/ 145 | 146 | ``` 147 | 148 | 以下是分布式训练的输出示例。 149 | 150 | ``` 151 | 16/02/26 05:41:59 INFO dmlc.Client: jobname=DMLC[nworker=2]:xgboost,username=ubuntu 152 | 16/02/26 05:41:59 INFO dmlc.Client: Submitting application application_1456461717456_0015 153 | 16/02/26 05:41:59 INFO impl.YarnClientImpl: Submitted application application_1456461717456_0015 154 | 2016-02-26 05:42:05,230 INFO @tracker All of 2 nodes getting started 155 | 2016-02-26 05:42:14,027 INFO [05:42:14] [0] test-error:0.016139 train-error:0.014433 156 | 2016-02-26 05:42:14,186 INFO [05:42:14] [1] test-error:0.000000 train-error:0.001228 157 | 2016-02-26 05:42:14,947 INFO @tracker All nodes finishes job 158 | 2016-02-26 05:42:14,948 INFO @tracker 9.71754479408 secs between node start and job finish 159 | Application application_1456461717456_0015 finished with state FINISHED at 1456465335961 160 | 161 | ``` 162 | 163 | ## 分析模型 164 | 165 | 模型训练后,我们可以分析学习的模型,并将其用于未来的预测任务。 XGBoost 是一个可移植的框架,所有平台的模型都是 **_exchangable(可交换)_** 。 这意味着我们可以在 python/R/Julia 中加载训练好的模型,并利用这些语言中的 data science pipelines (数据科学 pipeline)来做模型分析和预测。 166 | 167 | 例如,你可以使用 [这个 ipython notebook](https://github.com/dmlc/xgboost/tree/master/demo/distributed-training/plot_model.ipynb) 来绘制 feature importance (特征重要性)和可视化的学习模型。 168 | 169 | ## 故障排除 170 | 171 | 遇到问题的时候,最好的方法可能是使用以下命令获取容器的 stdout 和 stderr 的日志,以检查导致问题的原因。 172 | 173 | ``` 174 | yarn logs -applicationId yourAppId 175 | 176 | ``` 177 | 178 | ## 未来发展方向 179 | 180 | 在本教程中,您已经学会了在 YARN 上使用分布式 XGBoost 。 XGBoost 是用于渐变增强的可移植和可伸缩框架。 您可以在 [资源页面](https://github.com/dmlc/xgboost/blob/master/demo/README.md) 中查看更多的示例和资源。 181 | 182 | 该项目的目标是为所有平台提供最佳的可扩展机器学习解决方案。 API 被设计为可移植的,相同的代码也可以在其他平台上运行,例如 MPI 和 SGE 。 XGBoost 正在积极发展,我们正在开发更多令人兴奋的功能,如分布式 xgboost python/R 包。查看 [路线图](https://github.com/dmlc/xgboost/issues/873) 来了解更多的细节并且欢迎你为这个项目你做出贡献。 -------------------------------------------------------------------------------- /docs/5.md: -------------------------------------------------------------------------------- 1 | # DART booster 2 | 3 | [XGBoost](https://github.com/dmlc/xgboost) 主要是将大量带有较小的 Learning rate (学习率) 的回归树做了混合。 在这种情况下,在构造前期增加树的意义是非常显著的,而在后期增加树并不那么重要。 4 | 5 | Rasmi 等人从深度神经网络社区提出了一种新的方法来增加 boosted trees 的 dropout 技术,并且在某些情况下能得到更好的结果。 6 | 7 | 这是一种新型树结构 booster `dart` 的使用指南。 8 | 9 | ## 原始论文 10 | 11 | Rashmi Korlakai Vinayak, Ran Gilad-Bachrach. “DART: Dropouts meet Multiple Additive Regression Trees.” [JMLR](http://www.jmlr.org/proceedings/papers/v38/korlakaivinayak15.pdf) 12 | 13 | ## 特性 14 | 15 | * 直接 drop 树来解决 over-fitting(过拟合)。 16 | * Trivial trees 会被阻止(纠正微不足道的错误)。 17 | 18 | 由于训练过程中的引入的随机性,会有下面的几点区别。 19 | 20 | * 训练可能会比 `gbtree` 慢,因为随机地 dropout 会禁止使用 prediction buffer (预测缓存区)。 21 | * 由于随机性,提早停止可能会不稳定。 22 | 23 | ## 它是如何运行的 24 | 25 | * 在第 ![](img/0.72/bac9598d3338ed61b7a118621dedea77.jpg) 轮训练中,假设 ![](img/0.72/4c8dff663d8cee873b593e54d56baccb.jpg) 个树被选定 drop 。 26 | * 使用 ![](img/0.72/43354e497c557600517f0d5839d8c4e7.jpg) 作为 drop 的树的 leaf scores (叶子分数)和 ![](img/0.72/4451c509ff07f4326844859d1bbb7a56.jpg) 作为新树的 leaf scores (叶子分数)。 27 | * 下面是目标函数 : 28 | 29 | ![](img/0.72/5ec429f9c4fa5c7660b705bcf8723ac9.jpg) 30 | 31 | * ![](img/0.72/f3d01ce46b3fe38877c9cc0f7d12db03.jpg) 和 ![](img/0.72/c347c8efe6d5830b8c0cf3828e8275db.jpg) 是 overshooting (超调), 所以使用 scale factor (比例因子) 32 | 33 | ![](img/0.72/40168c626a126a5ece60aa03c2ef69b0.jpg) 34 | 35 | ## 参数 36 | 37 | ### booster 38 | 39 | * `dart` 40 | 41 | 这个 booster 继承了 `gbtree` ,所以 `dart` 还有 `eta`, `gamma`, `max_depth` 等等参数。 42 | 43 | 其他的参数如下所示。 44 | 45 | ### sample_type 46 | 47 | sampling (采样)算法的类型。 48 | 49 | * `uniform`: (默认) drop 的树被统一选择。 50 | * `weighted`: 根据 weights(权重)选择 drop 的树。 51 | 52 | ### normalize_type 53 | 54 | normalization (归一化)算法的类型。 55 | 56 | * `tree`: (默认) 新树与 drop 的树的 weight(权重)相同。 57 | 58 | ![](img/0.72/d9f69ea79be64a6a07e67d338aafe6aa.jpg) 59 | 60 | * `forest`: 新树具有与 drop 的树(森林)的权重的总和相同的权重。 61 | 62 | ![](img/0.72/5aa5a49c3668860ed0ac3e6b62d3cc93.jpg) 63 | 64 | ### rate_drop 65 | 66 | dropout 比率. 67 | 68 | * 范围: [0.0, 1.0] 69 | 70 | ### skip_drop 71 | 72 | 跳过 dropout 的概率。 73 | 74 | * 如果一个 dropout 被跳过了,新的树将会像 gbtree 一样被添加。 75 | * 范围: [0.0, 1.0] 76 | 77 | ## 示例脚本 78 | 79 | ``` 80 | import xgboost as xgb 81 | # read in data 82 | dtrain = xgb.DMatrix('demo/data/agaricus.txt.train') 83 | dtest = xgb.DMatrix('demo/data/agaricus.txt.test') 84 | # specify parameters via map 85 | param = {'booster': 'dart', 86 | 'max_depth': 5, 'learning_rate': 0.1, 87 | 'objective': 'binary:logistic', 'silent': True, 88 | 'sample_type': 'uniform', 89 | 'normalize_type': 'tree', 90 | 'rate_drop': 0.1, 91 | 'skip_drop': 0.5} 92 | num_round = 50 93 | bst = xgb.train(param, dtrain, num_round) 94 | # make prediction 95 | # ntree_limit must not be 0 96 | preds = bst.predict(dtest, ntree_limit=num_round) 97 | 98 | ``` -------------------------------------------------------------------------------- /docs/6.md: -------------------------------------------------------------------------------- 1 | # XGBoost 入门指引 2 | 3 | 该页面包含使用和开发 XGBoost 的一些指导。 4 | 5 | ## 安装 6 | 7 | * [如何安装 XGBoost](../build.html) 8 | 9 | ## 以特定的方式使用 XGBoost 10 | 11 | * [参数调整指南](param_tuning.html) 12 | * [使用大数据集的 out of core 计算](external_memory.html) 13 | 14 | ## 开发和破解 XGBoost 15 | 16 | * [为 XGBoost 做贡献](contribute.html) 17 | 18 | ## 常见问题 19 | 20 | * [FAQ](../faq.html) -------------------------------------------------------------------------------- /docs/7.md: -------------------------------------------------------------------------------- 1 | # 安装指南 2 | 3 | 该页面提供了有关如何在各种操作系统上构建和安装 xgboost 软件包的说明. 由如下两个步骤组成: 4 | 5 | 1. 首先, 从 C++ 代码中构建共享库(针对 linux/osx 的是 `libxgboost.so` 然后针对 windows 的是 `libxgboost.dll`). 6 | * Exception: 针对 R 软件包的安装请直接参考 R 软件包的部分. 7 | 2. 然后, 安装相关的编程语言软件包(例如. Python 软件包). 8 | 9 | **_重要提示_** 最新版本的 xgboost 使用子模块来维护软件包, 所以当你 clone repo 时, 记得按如下方式使用递归选项. 10 | 11 | ``` 12 | git clone --recursive https://github.com/dmlc/xgboost 13 | 14 | ``` 15 | 16 | 针对使用 github 工具的 windows 用户, 可以打开 git shell, 然后输入以下命令. 17 | 18 | ``` 19 | git submodule init 20 | git submodule update 21 | 22 | ``` 23 | 24 | 如果你在安装期间有任何问题, 请首先参考 [故障排除部分](#id5). 如果其中的说明不适合你, 请放心的到 [xgboost-doc-zh/issues](https://github.com/apachecn/xgboost-doc-zh/issues) 上提问题, 或者如果你能解决该问题, 最好发起一个 pull request. 25 | 26 | ## 页面内容目录 27 | 28 | * [构建共享库](#id3) 29 | * [在 Ubuntu/Debian 上构建](#ubuntu-debian) 30 | * [在 OSX 上构建](#osx) 31 | * [在 Windows 上构建](#windows) 32 | * [自定义构建](#id4) 33 | * [Python 软件包安装](#python) 34 | * [R 软件包安装](#r) 35 | * [故障排查](#id5) 36 | 37 | ## 构建共享库 38 | 39 | 我们的目标是构建共享库: 40 | 41 | * 在 Linux/OSX 上的目标库是 `libxgboost.so` 42 | * 在 Windows 上的目标库是 `libxgboost.dll` 43 | 44 | 最小的构建要求是 45 | 46 | * 最新的支持 C++ 11 的 c++ 编译器(g++-4.6 or higher) 47 | 48 | 我们可以编辑 `make/config.mk` 以改变编译选项, 然后通过 `make` 命令来构建. 如果一切顺利, 我们可以去特定的编程语言安装部分. 49 | 50 | ### 在 Ubuntu/Debian 上构建 51 | 52 | 在 Ubuntu 上, 构建 xgboost 的命令如下 53 | 54 | ``` 55 | git clone --recursive https://github.com/dmlc/xgboost 56 | cd xgboost; make -j4 57 | 58 | ``` 59 | 60 | ### 在 OSX 上构建 61 | 62 | 在 OSX 上, 构建 xgboost 的命令如下 63 | 64 | ``` 65 | git clone --recursive https://github.com/dmlc/xgboost 66 | cd xgboost; cp make/minimum.mk ./config.mk; make -j4 67 | 68 | ``` 69 | 70 | 这样就可以在不使用多线程的情况下构建 xgboost 了, 因为默认情况下, OSX 中的 clang 不会带有 open-mp. 有关启用 OpenMP 的 xgboost, 请参阅以下段落. 71 | 72 | 以下是使用 OpenMP 的编译器来安装 XGBoost 的完整解决方案. 通过命令 `brew install gcc --without-multilib` 获得 gcc-5.x.x 与 openmap 的支持. (brew 是 OSX 上 `apt-get` 的标准组件. 因此不建议单独安装 [HPC](http://hpc.sourceforge.net/), 但是它应该也是可用的.) 73 | 74 | ``` 75 | git clone --recursive https://github.com/dmlc/xgboost 76 | cd xgboost; cp make/config.mk ./config.mk; make -j4 77 | 78 | ``` 79 | 80 | ### 在 Windows 上构建 81 | 82 | 您在 clone repo 时需要首先使用递归选项来 clone 子模块. 如果使用的是 github 工具, 可以打开 github-shell, 然后输入以下命令. 我们推荐使用 [Windows 版本的 Git](https://git-for-windows.github.io/), 因为它自带了一个标准的 bash shell. 将极大地简化安装过程. 83 | 84 | ``` 85 | git submodule init 86 | git submodule update 87 | 88 | ``` 89 | 90 | XGBoost 支持由 MSVC 或 MinGW 来构建. 以下是你如何使用 MinGW 构建 xgboost 库的说明. 91 | 92 | 在安装完 [Windows 版本的 Git](https://git-for-windows.github.io/) 之后, 应该有一个 `Git Bash` 的快捷方式. 以下所有的步骤都可以在 `Git Bash` 中进行. 93 | 94 | 在 MinGW 中, `make` 命令是 `mingw32-make` 这个名字. 你可以添加下面的行道 `.bashrc` 文件中去. 95 | 96 | ``` 97 | alias make='mingw32-make' 98 | 99 | ``` 100 | 101 | 要使用 MinGW 来构建 102 | 103 | ``` 104 | cp make/mingw64.mk config.mk; make -j4 105 | 106 | ``` 107 | 108 | 要使用 cmake 来与 Visual Studio 2013 构建. 确保你有最新版本的 cmake 并且已添加到你的 path 中. 然后从 xgboost 目录执行以下命令: 109 | 110 | ``` 111 | mkdir build 112 | cd build 113 | cmake .. -G"Visual Studio 12 2013 Win64" 114 | 115 | ``` 116 | 117 | This specifies an out of source build using the MSVC 12 64 bit generator. Open the .sln file in the build directory and build with Visual Studio. To use the Python module you can copy libxgboost.dll into python-package\xgboost. 118 | 119 | 这指定使用 MSVC 12 64 位生成器的源代码来构建. 在构建目录中打开 .sln 文件并使用 Visual Studio 进行构建. 要使用 Python 模块, 您可以将 libxgboost.dll 复制到 python-package\xgboost 目录下去. 120 | 121 | 其他版本的 Visual Studio 可能会工作, 但未经测试. 122 | 123 | ### 自定义构建 124 | 125 | xgboost 的配置可以通过 `config.mk` 来进行修改 126 | 127 | * 修改各种分布式文件系统上的配置, 如 HDFS/Amazon S3/ ... 128 | * 首先, 复制 [make/config.mk](https://github.com/dmlc/xgboost/tree/master/doc/../make/config.mk) 到项目的根目录下, 任何本地的修改都将被 git 忽略, 然后修改相应的 flags(标记). 129 | 130 | ## Python 软件包的安装 131 | 132 | python 软件包位于 [python-package](https://github.com/dmlc/xgboost/tree/master/doc/../python-package) 目录下. 以下是几种安装软件包的方法: 133 | 134 | 1. 系统范围的安装, 需要 root 权限 135 | 136 | ``` 137 | cd python-package; sudo python setup.py install 138 | 139 | ``` 140 | 141 | 但是你需要 Python `distutils` 模块才能工作. 它通常是核心 python 软件包的一部分, 或者可以使用你的软件包管理器进行安装. 例如. 在 Debian 中使用以下命令 142 | 143 | ``` 144 | sudo apt-get install python-setuptools 145 | 146 | ``` 147 | 148 | _注意: 如果您重新编译了 xgboost, 那么您需要重新安装它才能使新库生效_ 149 | 150 | 2. 只设置环境变量 `PYTHONPATH` 来让 python 知道在哪里可以找相关的库. 例如, 假设我们在主目录 `〜` 上克隆了 `xgboost`. 那么我们可以在 `〜/ .bashrc` 文件中加入下面这行. 这是 _推荐给哪些可能更改代码的开发者_ 的. 一旦你 pull(拉取)代码并且重构该项目(不需要再次调用 `setup`), 这些更改就会立即体现出来. 151 | 152 | ``` 153 | export PYTHONPATH=~/xgboost/python-package 154 | 155 | ``` 156 | 157 | 3. 只为当前用户安装. 158 | 159 | ``` 160 | cd python-package; python setup.py develop --user 161 | 162 | ``` 163 | 164 | 4. 如果您正在安装需要编译的最新的 xgboost 版本, 请将 MinGW 添加到系统的 PATH 中去: 165 | 166 | ``` 167 | import os 168 | os.environ['PATH'] = os.environ['PATH'] + ';C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin' 169 | 170 | ``` 171 | 172 | ## R 软件包安装 173 | 174 | 您可以像安装其他软件包一样从 cran 来安装 R 软件包, 也可以从我们每周更新的 drat 软件仓库来进行安装: 175 | 176 | ``` 177 | install.packages("drat", repos="https://cran.rstudio.com") 178 | drat:::addRepo("dmlc") 179 | install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source") 180 | 181 | ``` 182 | 183 | 如果您想使用最新的 xgboost 版本, 并且已经编译了 xgboost, 请使用 `library(devtools); install('xgboost/R-package')` 来手动的安装 xgboost 软件包(根据你编译的 xgboost 来恰当的更改 path) 184 | 185 | 对于 OSX 用户, 将安装单线程版本, 要安装多线程版本. 首先按照 [在 OSX 上构建](#在 OSX 上构建) 上的说明来获取 OpenMP 激活的编译器, 然后: 186 | 187 | * 为 R 设置最高优先级的 `Makevars` 文件. 188 | 189 | 重点是, 有三种 `Makevars` : `~/.R/Makevars`, `xgboost/R-package/src/Makevars` 以及`/usr/local/Cellar/r/3.2.0/R.framework/Resources/etc/Makeconf` (最后一个通过在 R 中运行 `file.path(R.home("etc"), "Makeconf")` 来获得), 并且 `SHLIB_OPENMP_CXXFLAGS` 不是默认设置!! 在尝试后, 似乎第一个具有最高的优先级 (震精吧!). 190 | 191 | 然后在 R 中, 允许 192 | 193 | ``` 194 | install.packages("drat", repos="https://cran.rstudio.com") 195 | drat:::addRepo("dmlc") 196 | install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source") 197 | 198 | ``` 199 | 200 | 由于子模块的使用, `install_github` 不再支持安装最新版本的 R 软件包. 要安装最新的版本, 可以运行下面的 bash 脚本, 201 | 202 | ``` 203 | git clone --recursive https://github.com/dmlc/xgboost 204 | cd xgboost 205 | git submodule init 206 | git submodule update 207 | alias make='mingw32-make' 208 | cd dmlc-core 209 | make -j4 210 | cd ../rabit 211 | make lib/librabit_empty.a -j4 212 | cd .. 213 | cp make/mingw64.mk config.mk 214 | make -j4 215 | 216 | ``` 217 | 218 | ## 故障排查 219 | 220 | 1. **在 `git pull` 后编译失败** 221 | 222 | 请先 update the submodules, clean all 然后重新编译: 223 | 224 | ``` 225 | git submodule update && make clean_all && make -j4 226 | 227 | ``` 228 | 229 | 1. **在修改 `config.mk` 配置文件后编译失败** 230 | 231 | 需要先 clean all: 232 | 233 | ``` 234 | make clean_all && make -j4 235 | 236 | ``` 237 | 238 | 1. **Makefile: dmlc-core/make/dmlc.mk: No such file or directory** 239 | 240 | 我们需要递归的 clone 子模块, 您可以这样做: 241 | 242 | ``` 243 | git submodule init 244 | git submodule update 245 | 246 | ``` 247 | 248 | Alternatively, do another clone 249 | 250 | ``` 251 | git clone https://github.com/dmlc/xgboost --recursive 252 | 253 | ``` -------------------------------------------------------------------------------- /docs/8.md: -------------------------------------------------------------------------------- 1 | # 参数调整注意事项 2 | 3 | 参数调整是机器学习中的一门暗艺术,模型的最优参数可以依赖于很多场景。所以要创建一个全面的指导是不可能的。 4 | 5 | 本文档试图为 xgboost 中的参数提供一些指导意见。 6 | 7 | ## 理解 Bias-Variance(偏差-方差)权衡 8 | 9 | 如果你了解一些机器学习或者统计课程,你会发现这可能是最重要的概念之一。 当我们允许模型变得更复杂(例如深度更深)时,模型具有更好的拟合训练数据的能力,会产生一个较少的偏差模型。 但是,这样复杂的模型需要更多的数据来拟合。 10 | 11 | xgboost 中的大部分参数都是关于偏差方差的权衡的。最好的模型应该仔细地将模型复杂性与其预测能力进行权衡。 [参数文档](https://github.com/dmlc/xgboost/tree/master/doc/how_to/parameter.md) 会告诉你每个参数是否会使得模型更加 conservative (保守)与否。这可以帮助您在复杂模型和简单模型之间灵活转换。 12 | 13 | ## 控制过拟合 14 | 15 | 当你观察到训练精度高,但是测试精度低时,你可能遇到了过拟合的问题。 16 | 17 | 通常有两种方法可以控制 xgboost 中的过拟合。 18 | 19 | * 第一个方法是直接控制模型的复杂度 20 | * 这包括 `max_depth`, `min_child_weight` 和 `gamma` 21 | * 第二种方法是增加随机性,使训练对噪声强健 22 | * 这包括 `subsample`, `colsample_bytree` 23 | * 你也可以减小步长 `eta`, 但是当你这么做的时候需要记得增加 `num_round` 。 24 | 25 | ## 处理不平衡的数据集 26 | 27 | 对于广告点击日志等常见情况,数据集是极不平衡的。 这可能会影响 xgboost 模型的训练,有两种方法可以改善它。 28 | 29 | * 如果你只关心预测的排名顺序(AUC) 30 | * 通过 `scale_pos_weight` 来平衡 positive 和 negative 权重。 31 | * 使用 AUC 进行评估 32 | * 如果你关心预测正确的概率 33 | * 在这种情况下,您无法重新平衡数据集 34 | * 在这种情况下,将参数 `max_delta_step` 设置为有限数字(比如说1)将有助于收敛 -------------------------------------------------------------------------------- /docs/9.md: -------------------------------------------------------------------------------- 1 | # 使用 XGBoost 外部存储器版本(测试版) 2 | 3 | 使用外部存储器版本和内存版本没有太大的区别。 唯一的区别是文件名格式。 4 | 5 | 外部存储器版本采用以下文件名格式 6 | 7 | ``` 8 | filename#cacheprefix 9 | 10 | ``` 11 | 12 | `filename` 是要加载的 libsvm 文件的正常路径, `cacheprefix` 是一个 xgboost 将用于外部内存缓存的缓存文件的路径。 13 | 14 | 下面的代码是从 [../demo/guide-python/external_memory.py](https://github.com/dmlc/xgboost/tree/master/doc/demo/guide-python/external_memory.py) 中提取的。 15 | 16 | ``` 17 | dtrain = xgb.DMatrix('../data/agaricus.txt.train#dtrain.cache') 18 | 19 | ``` 20 | 21 | 你可以在 libsvm 文件后面找到 `#dtrain.cache` ,这是缓存文件的名称。 对于 CLI 版本,只需在文件名中使用 `"../data/agaricus.txt.train#dtrain.cache"` 。 22 | 23 | ## 性能说明 24 | 25 | * 参数 `nthread` 应该设置为 **_real_** cores 的数量 26 | * 大多数现代 CPU 提供 hyperthreading (超线程),这意味着你可以拥有 8 个线程的 4 核 CPU 27 | * 在这种情况下,将 nthread 设置为 4 以获得更高性能 28 | 29 | ## 分布式版本 30 | 31 | 外部存储器模式很自然地适用于分布式版本,您可以简单地设置路径就像这样 32 | 33 | ``` 34 | data = "hdfs:///path-to-data/#dtrain.cache" 35 | 36 | ``` 37 | 38 | xgboost 会将数据缓存到本地位置。在 YARN 上运行时,当前文件夹是暂时的,这样你就可以直接使用 `dtrain.cache` 来缓存当前文件夹。 39 | 40 | ## 用法说明 41 | 42 | * 这是一个实验版本 43 | * 如果你想尝试测试,请将结果报告至 https://github.com/dmlc/xgboost/issues/244 44 | * 目前只支持从 libsvm 格式导入 45 | * 欢迎从其他常见的外部存储器数据源采集的贡献 -------------------------------------------------------------------------------- /docs/img/0.72/0507a5548594983588fdc7c98687b36b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/0507a5548594983588fdc7c98687b36b.jpg -------------------------------------------------------------------------------- /docs/img/0.72/09858ff3ca719faf578ad5b13b3c98fa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/09858ff3ca719faf578ad5b13b3c98fa.jpg -------------------------------------------------------------------------------- /docs/img/0.72/0d22e8726e5829598054d2585d7c9370.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/0d22e8726e5829598054d2585d7c9370.jpg -------------------------------------------------------------------------------- /docs/img/0.72/11710d80af8ff3712f529745adf5409a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/11710d80af8ff3712f529745adf5409a.jpg -------------------------------------------------------------------------------- /docs/img/0.72/1476c1e968148d38644efcce09c2bef4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/1476c1e968148d38644efcce09c2bef4.jpg -------------------------------------------------------------------------------- /docs/img/0.72/17131c421b074dc314397e82a4528438.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/17131c421b074dc314397e82a4528438.jpg -------------------------------------------------------------------------------- /docs/img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/1c13f41f3ec9bd4445ae9fb223b4ce4a.jpg -------------------------------------------------------------------------------- /docs/img/0.72/1d3fcd8d09d65c0ee710f95bf8422ad9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/1d3fcd8d09d65c0ee710f95bf8422ad9.jpg -------------------------------------------------------------------------------- /docs/img/0.72/1fe2cf4fb357117e177388becb68d9f9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/1fe2cf4fb357117e177388becb68d9f9.jpg -------------------------------------------------------------------------------- /docs/img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/228674793358bc993a8dcb3c2861a3ee.jpg -------------------------------------------------------------------------------- /docs/img/0.72/25bce8f7365849fcbccf06c572280bfd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/25bce8f7365849fcbccf06c572280bfd.jpg -------------------------------------------------------------------------------- /docs/img/0.72/2c05306f7baa0066128b8f8afd95ec37.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/2c05306f7baa0066128b8f8afd95ec37.jpg -------------------------------------------------------------------------------- /docs/img/0.72/2c864507ad886978650e8f67f3224afe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/2c864507ad886978650e8f67f3224afe.jpg -------------------------------------------------------------------------------- /docs/img/0.72/2d3bec80be56303ea525a39cd4395d5c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/2d3bec80be56303ea525a39cd4395d5c.jpg -------------------------------------------------------------------------------- /docs/img/0.72/35b6f55e2b5953ff94ee568f744b4efb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/35b6f55e2b5953ff94ee568f744b4efb.jpg -------------------------------------------------------------------------------- /docs/img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/390b4cd4db1c07e3db74b0810913ffc8.jpg -------------------------------------------------------------------------------- /docs/img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/3c11d8d84433d2138c31a421b1be11c7.jpg -------------------------------------------------------------------------------- /docs/img/0.72/40168c626a126a5ece60aa03c2ef69b0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/40168c626a126a5ece60aa03c2ef69b0.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4028c0134b3b847f0e97b4cd284bc927.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4028c0134b3b847f0e97b4cd284bc927.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4194e8522c4e867f714b492a4439dae8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4194e8522c4e867f714b492a4439dae8.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4330c12a952e7f831231b51700bcd390.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4330c12a952e7f831231b51700bcd390.jpg -------------------------------------------------------------------------------- /docs/img/0.72/43354e497c557600517f0d5839d8c4e7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/43354e497c557600517f0d5839d8c4e7.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4451c509ff07f4326844859d1bbb7a56.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4451c509ff07f4326844859d1bbb7a56.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4c8dff663d8cee873b593e54d56baccb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4c8dff663d8cee873b593e54d56baccb.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4dc70a02830b485f3f26015c8fb1fdb9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4dc70a02830b485f3f26015c8fb1fdb9.jpg -------------------------------------------------------------------------------- /docs/img/0.72/4ef880d0d67e58f282ce4ed79d4f9549.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/4ef880d0d67e58f282ce4ed79d4f9549.jpg -------------------------------------------------------------------------------- /docs/img/0.72/51b7cc80809f3eada5745a2e5f79b18d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/51b7cc80809f3eada5745a2e5f79b18d.jpg -------------------------------------------------------------------------------- /docs/img/0.72/560afea477f6995994b0cfff8262e34d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/560afea477f6995994b0cfff8262e34d.jpg -------------------------------------------------------------------------------- /docs/img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/585ba860aa933d05565a569d8d1ddf93.jpg -------------------------------------------------------------------------------- /docs/img/0.72/5aa5a49c3668860ed0ac3e6b62d3cc93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/5aa5a49c3668860ed0ac3e6b62d3cc93.jpg -------------------------------------------------------------------------------- /docs/img/0.72/5ec429f9c4fa5c7660b705bcf8723ac9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/5ec429f9c4fa5c7660b705bcf8723ac9.jpg -------------------------------------------------------------------------------- /docs/img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/654b00d1036ba7f7d93e02f57fc00a75.jpg -------------------------------------------------------------------------------- /docs/img/0.72/683c9a76e2b8489a4a3d0ffdec2ad441.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/683c9a76e2b8489a4a3d0ffdec2ad441.jpg -------------------------------------------------------------------------------- /docs/img/0.72/728afccdae39c1bac6479386dab442e8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/728afccdae39c1bac6479386dab442e8.jpg -------------------------------------------------------------------------------- /docs/img/0.72/77116c2aaf28d1d862f8095806911151.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/77116c2aaf28d1d862f8095806911151.jpg -------------------------------------------------------------------------------- /docs/img/0.72/7d80469ba9822a0d05b7140b4ca0290a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/7d80469ba9822a0d05b7140b4ca0290a.jpg -------------------------------------------------------------------------------- /docs/img/0.72/87142829e4107d70b9cae3f8b2d095fc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/87142829e4107d70b9cae3f8b2d095fc.jpg -------------------------------------------------------------------------------- /docs/img/0.72/8a5adca27b799741caabbdeae20be5cf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/8a5adca27b799741caabbdeae20be5cf.jpg -------------------------------------------------------------------------------- /docs/img/0.72/8c50b9fb6c2c85cbc672ab618d01c39b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/8c50b9fb6c2c85cbc672ab618d01c39b.jpg -------------------------------------------------------------------------------- /docs/img/0.72/8e83474bbce57dfc2d0399adceb655b3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/8e83474bbce57dfc2d0399adceb655b3.jpg -------------------------------------------------------------------------------- /docs/img/0.72/907939506800cf89ad2ed0d2d05cfabc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/907939506800cf89ad2ed0d2d05cfabc.jpg -------------------------------------------------------------------------------- /docs/img/0.72/94f79ae2273f820cc565fdebf14a9f63.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/94f79ae2273f820cc565fdebf14a9f63.jpg -------------------------------------------------------------------------------- /docs/img/0.72/98b4f83629c037523fd162ed4b216f51.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/98b4f83629c037523fd162ed4b216f51.jpg -------------------------------------------------------------------------------- /docs/img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/a3b9b8a59a7320d10d212f59e05036c4.jpg -------------------------------------------------------------------------------- /docs/img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/a787da64e8c74cd0b52223ce8d686f68.jpg -------------------------------------------------------------------------------- /docs/img/0.72/a96052742f7423a92cfcad03a185fa63.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/a96052742f7423a92cfcad03a185fa63.jpg -------------------------------------------------------------------------------- /docs/img/0.72/aa297e24fc75c747a07b290638760b43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/aa297e24fc75c747a07b290638760b43.jpg -------------------------------------------------------------------------------- /docs/img/0.72/ab0e7d4ab7d7b6e0a5aa4383fcdd2ee5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/ab0e7d4ab7d7b6e0a5aa4383fcdd2ee5.jpg -------------------------------------------------------------------------------- /docs/img/0.72/ad3e76b49257d997698faa2d585c2a0a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/ad3e76b49257d997698faa2d585c2a0a.jpg -------------------------------------------------------------------------------- /docs/img/0.72/af220a242098880c9f5524587fac68c5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/af220a242098880c9f5524587fac68c5.jpg -------------------------------------------------------------------------------- /docs/img/0.72/b201e8f1610bd6f5f4a4799b885df578.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/b201e8f1610bd6f5f4a4799b885df578.jpg -------------------------------------------------------------------------------- /docs/img/0.72/b8afcf3f3647596ed0584af454f840a9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/b8afcf3f3647596ed0584af454f840a9.jpg -------------------------------------------------------------------------------- /docs/img/0.72/b999689ef453cce06ffd631a571e1f29.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/b999689ef453cce06ffd631a571e1f29.jpg -------------------------------------------------------------------------------- /docs/img/0.72/bac9598d3338ed61b7a118621dedea77.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/bac9598d3338ed61b7a118621dedea77.jpg -------------------------------------------------------------------------------- /docs/img/0.72/c347c8efe6d5830b8c0cf3828e8275db.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/c347c8efe6d5830b8c0cf3828e8275db.jpg -------------------------------------------------------------------------------- /docs/img/0.72/c9379d9b2e521341735b00d845051d04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/c9379d9b2e521341735b00d845051d04.jpg -------------------------------------------------------------------------------- /docs/img/0.72/cdab9437b701fd21fb3294cfba7c4bc2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/cdab9437b701fd21fb3294cfba7c4bc2.jpg -------------------------------------------------------------------------------- /docs/img/0.72/ce9bf02722174f83b83dc21985022455.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/ce9bf02722174f83b83dc21985022455.jpg -------------------------------------------------------------------------------- /docs/img/0.72/d9d5f5978eda3e268a05e689f897c9c6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/d9d5f5978eda3e268a05e689f897c9c6.jpg -------------------------------------------------------------------------------- /docs/img/0.72/d9f69ea79be64a6a07e67d338aafe6aa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/d9f69ea79be64a6a07e67d338aafe6aa.jpg -------------------------------------------------------------------------------- /docs/img/0.72/dd45717d5b8500473d4d5cc5e8da2d43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/dd45717d5b8500473d4d5cc5e8da2d43.jpg -------------------------------------------------------------------------------- /docs/img/0.72/f3d01ce46b3fe38877c9cc0f7d12db03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/f3d01ce46b3fe38877c9cc0f7d12db03.jpg -------------------------------------------------------------------------------- /docs/img/0.72/f9a24042b2fe37eb28c8462d0195c985.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/f9a24042b2fe37eb28c8462d0195c985.jpg -------------------------------------------------------------------------------- /docs/img/0.72/ff439882e70c47df87d58c837a372490.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/0.72/ff439882e70c47df87d58c837a372490.jpg -------------------------------------------------------------------------------- /docs/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apachecn/xgboost-doc-zh/fe3c679820ae9c3c6352b73129061e74160329a1/docs/img/logo.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
now loading...
21 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | git add -A 2 | git commit -am "$(date "+%Y-%m-%d %H:%M:%S")" 3 | git push --------------------------------------------------------------------------------