From eecf341ea7bdf8c508a1015f41cdd9bb528e29c7 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 18 Jun 2018 22:09:39 -0700 Subject: [PATCH] [jvm-packages] Added latest version number example (#3374) * Added latest version number example * Added latest version number example --- doc/jvm/index.md | 65 ++++++++++++++++++++++++++++++++++++++---- jvm-packages/README.md | 4 ++- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/doc/jvm/index.md b/doc/jvm/index.md index 56e6bc25b..d916cc03d 100644 --- a/doc/jvm/index.md +++ b/doc/jvm/index.md @@ -7,7 +7,10 @@ You have found the XGBoost JVM Package! Installation ------------ -Currently, XGBoost4J only support installation from source. Building XGBoost4J using Maven requires Maven 3 or newer, Java 7+ and CMake 3.2+ for compiling the JNI bindings. + +#### Installation from source + +Building XGBoost4J using Maven requires Maven 3 or newer, Java 7+ and CMake 3.2+ for compiling the JNI bindings. Before you install XGBoost4J, you need to define environment variable `JAVA_HOME` as your JDK directory to ensure that your compiler can find `jni.h` correctly, since XGBoost4J relies on JNI to implement the interaction between the JVM and native libraries. @@ -23,14 +26,64 @@ Or, if you would like to skip tests, run This command will publish the xgboost binaries, the compiled java classes as well as the java sources to your local repository. Then you can use XGBoost4J in your Java projects by including the following dependency in `pom.xml`: - - ml.dmlc - xgboost4j - 0.7 - +maven + +``` + + ml.dmlc + xgboost4j + latest_source_version_num + +``` + +For sbt, please add the repository and dependency in build.sbt as following: + +sbt +```sbt +resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository" + +"ml.dmlc" % "xgboost4j" % "latest_source_version_num" +``` +#### Installation from repo +You need to add github as repo: + +maven: + +```xml + + GitHub Repo + GitHub Repo + https://raw.githubusercontent.com/CodingCat/xgboost/maven-repo/ + +``` + +sbt: + +```sbt +resolvers += "GitHub Repo" at "https://raw.githubusercontent.com/CodingCat/xgboost/maven-repo/" +``` + +the add dependency as following: + +maven + +``` + + ml.dmlc + xgboost4j + latest_version_num + +``` + +sbt +```sbt + "ml.dmlc" % "xgboost4j" % "latest_version_num" +``` + +For the latest release version number, please check [here](https://github.com/dmlc/xgboost/releases). After integrating with Dataframe/Dataset APIs of Spark 2.0, XGBoost4J-Spark only supports compile with Spark 2.x. You can build XGBoost4J-Spark as a component of XGBoost4J by running `mvn package`, and you can specify the version of spark with `mvn -Dspark.version=2.0.0 package`. (To continue working with Spark 1.x, the users are supposed to update pom.xml by modifying the properties like `spark.version`, `scala.version`, and `scala.binary.version`. Users also need to change the implementation by replacing SparkSession with SQLContext and the type of API parameters from Dataset[_] to Dataframe) diff --git a/jvm-packages/README.md b/jvm-packages/README.md index cd6c24d23..4fef01e13 100644 --- a/jvm-packages/README.md +++ b/jvm-packages/README.md @@ -57,6 +57,8 @@ the add dependency as following: "ml.dmlc" % "xgboost4j" % "latest_version_num" ``` +For the latest release version number, please check [here](https://github.com/dmlc/xgboost/releases). + if you want to use `xgboost4j-spark`, you just need to replace xgboost4j with `xgboost4j-spark` ## Examples @@ -70,4 +72,4 @@ be found in the [examples package](https://github.com/dmlc/xgboost/tree/master/j * Spark does the internal conversion, and does not accept formats that are 0-based -* Whereas, use *0-based* indexes format when predicting in normal mode - for instance, while using the saved model in the Python package \ No newline at end of file +* Whereas, use *0-based* indexes format when predicting in normal mode - for instance, while using the saved model in the Python package