From 163149cb10df4079237188659ee8db6d14429a75 Mon Sep 17 00:00:00 2001 From: Hyunsu Cho Date: Tue, 14 Apr 2020 16:11:23 -0700 Subject: [PATCH] Document how to install from xgboost-maven-repo --- doc/jvm/index.rst | 193 +++++++++++++++++---------- doc/jvm/xgboost4j_spark_tutorial.rst | 34 +---- 2 files changed, 127 insertions(+), 100 deletions(-) diff --git a/doc/jvm/index.rst b/doc/jvm/index.rst index 436311d25..269238378 100644 --- a/doc/jvm/index.rst +++ b/doc/jvm/index.rst @@ -13,10 +13,136 @@ XGBoost JVM Package You have found the XGBoost JVM Package! +.. _install_jvm_packages: + ************ Installation ************ +.. contents:: + :local: + :backlinks: none + +Installation from Maven repository +================================== + +Access release version +---------------------- +You can use XGBoost4J in your Java/Scala application by adding XGBoost4J as a dependency: + +.. code-block:: xml + :caption: Maven + + + ... + + 2.12 + + + + ... + + ml.dmlc + xgboost4j_${scala.binary.version} + latest_version_num + + + ml.dmlc + xgboost4j-spark_${scala.binary.version} + latest_version_num + + + +.. code-block:: scala + :caption: sbt + + libraryDependencies ++= Seq( + "ml.dmlc" %% "xgboost4j" % "latest_version_num", + "ml.dmlc" %% "xgboost4j-spark" % "latest_version_num" + ) + +This will check out the latest stable version from the Maven Central. + +For the latest release version number, please check `here `_. + +.. note:: Using Maven repository hosted by the XGBoost project + + There may be some delay until a new release becomes available to Maven Central. If you would like to access the latest release immediately, add the Maven repositoryhosted by the XGBoost project: + + .. code-block:: xml + :caption: Maven + + + XGBoost4J Release Repo + XGBoost4J Release Repo + https://s3-us-west-2.amazonaws.com/xgboost-maven-repo/release/ + + + .. code-block:: scala + :caption: sbt + + resolvers += "XGBoost4J Release Repo" at "https://s3-us-west-2.amazonaws.com/xgboost-maven-repo/release/" + +Access SNAPSHOT version +----------------------- + +First add the following Maven repository hosted by the XGBoost project: + +.. code-block:: xml + :caption: Maven + + + XGBoost4J Snapshot Repo + XGBoost4J Snapshot Repo + https://s3-us-west-2.amazonaws.com/xgboost-maven-repo/snapshot/ + + +.. code-block:: scala + :caption: sbt + + resolvers += "XGBoost4J Snapshot Repo" at "https://s3-us-west-2.amazonaws.com/xgboost-maven-repo/snapshot/" + +Then add XGBoost4J as a dependency: + +.. code-block:: xml + :caption: maven + + + ... + + 2.12 + + + + ... + + ml.dmlc + xgboost4j_${scala.binary.version} + latest_version_num-SNAPSHOT + + + ml.dmlc + xgboost4j-spark_${scala.binary.version} + latest_version_num-SNAPSHOT + + + +.. code-block:: scala + :caption: sbt + + libraryDependencies ++= Seq( + "ml.dmlc" %% "xgboost4j" % "latest_version_num-SNAPSHOT", + "ml.dmlc" %% "xgboost4j-spark" % "latest_version_num-SNAPSHOT" + ) + +Look up the ``version`` field in `pom.xml `_ to get the correct version number. + +The SNAPSHOT JARs are hosted by the XGBoost project. Every commit in the ``master`` branch will automatically trigger generation of a new SNAPSHOT JAR. You can control how often Maven should upgrade your SNAPSHOT installation by specifying ``updatePolicy``. See `here `_ for details. + +.. note:: Windows not supported by published JARs + + The published JARs from the Maven Central and GitHub currently only supports Linux and MacOS. Windows users should consider building XGBoost4J / XGBoost4J-Spark from the source. Alternatively, checkout pre-built JARs from `criteo-forks/xgboost-jars `_. + Installation from source ======================== @@ -64,73 +190,6 @@ If you want to use XGBoost4J-Spark, replace ``xgboost4j`` with ``xgboost4j-spark Also, make sure to install Spark directly from `Apache website `_. **Upstream XGBoost is not guaranteed to work with third-party distributions of Spark, such as Cloudera Spark.** Consult appropriate third parties to obtain their distribution of XGBoost. -Installation from maven repo -============================ - -Access release version ----------------------- - -.. code-block:: xml - :caption: maven - - - ml.dmlc - xgboost4j - latest_version_num - - -.. code-block:: scala - :caption: sbt - - "ml.dmlc" % "xgboost4j" % "latest_version_num" - -This will checkout the latest stable version from the Maven Central. - -For the latest release version number, please check `here `_. - -if you want to use XGBoost4J-Spark, replace ``xgboost4j`` with ``xgboost4j-spark``. - -Access SNAPSHOT version ------------------------ - -You need to add GitHub as repo: - -.. code-block:: xml - :caption: maven - - - GitHub Repo - GitHub Repo - https://raw.githubusercontent.com/CodingCat/xgboost/maven-repo/ - - -.. code-block:: scala - :caption: sbt - - resolvers += "GitHub Repo" at "https://raw.githubusercontent.com/CodingCat/xgboost/maven-repo/" - -Then add dependency as following: - -.. code-block:: xml - :caption: maven - - - ml.dmlc - xgboost4j - latest_version_num - - -.. code-block:: scala - :caption: sbt - - "ml.dmlc" % "xgboost4j" % "latest_version_num" - -For the latest release version number, please check `here `_. - -.. note:: Windows not supported by published JARs - - The published JARs from the Maven Central and GitHub currently only supports Linux and MacOS. Windows users should consider building XGBoost4J / XGBoost4J-Spark from the source. Alternatively, checkout pre-built JARs from `criteo-forks/xgboost-jars `_. - Enabling OpenMP for Mac OS -------------------------- If you are on Mac OS and using a compiler that supports OpenMP, you need to go to the file ``xgboost/jvm-packages/create_jni.py`` and comment out the line diff --git a/doc/jvm/xgboost4j_spark_tutorial.rst b/doc/jvm/xgboost4j_spark_tutorial.rst index 8389aa703..67817613a 100644 --- a/doc/jvm/xgboost4j_spark_tutorial.rst +++ b/doc/jvm/xgboost4j_spark_tutorial.rst @@ -27,39 +27,7 @@ Build an ML Application with XGBoost4J-Spark Refer to XGBoost4J-Spark Dependency =================================== -Before we go into the tour of how to use XGBoost4J-Spark, we would bring a brief introduction about how to build a machine learning application with XGBoost4J-Spark. The first thing you need to do is to refer to the dependency in Maven Central. - -You can add the following dependency in your ``pom.xml``. - -.. code-block:: xml - - - ml.dmlc - xgboost4j-spark - latest_version_num - - -For the latest release version number, please check `here `_. - -We also publish some functionalities which would be included in the coming release in the form of snapshot version. To access these functionalities, you can add dependency to the snapshot artifacts. We publish snapshot version in github-based repo, so you can add the following repo in ``pom.xml``: - -.. code-block:: xml - - - XGBoost4J-Spark Snapshot Repo - XGBoost4J-Spark Snapshot Repo - https://raw.githubusercontent.com/CodingCat/xgboost/maven-repo/ - - -and then refer to the snapshot dependency by adding: - -.. code-block:: xml - - - ml.dmlc - xgboost4j-spark - next_version_num-SNAPSHOT - +Before we go into the tour of how to use XGBoost4J-Spark, you should first consult :ref:`Installation from Maven repository ` in order to add XGBoost4J-Spark as a dependency for your project. We provide both stable releases and snapshots. .. note:: XGBoost4J-Spark requires Apache Spark 2.4+