From 79d854c695aa5d32c022a2372902597fead1a23a Mon Sep 17 00:00:00 2001 From: Nan Zhu Date: Sat, 22 Sep 2018 16:39:38 -0700 Subject: [PATCH] [jvm-packages] fix errors in example (#3719) * add back train method but mark as deprecated * fix scalastyle error * add back train method but mark as deprecated * add back train method but mark as deprecated * add back train method but mark as deprecated * fix scalastyle error * fix scalastyle error * fix scalastyle error * instrumentation * use log console * better measurement * fix erros in example * update histmaker --- .../xgboost4j/scala/example/spark/SparkMLlibPipeline.scala | 6 +++++- src/tree/updater_histmaker.cc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jvm-packages/xgboost4j-example/src/main/scala/ml/dmlc/xgboost4j/scala/example/spark/SparkMLlibPipeline.scala b/jvm-packages/xgboost4j-example/src/main/scala/ml/dmlc/xgboost4j/scala/example/spark/SparkMLlibPipeline.scala index ea54b457ac04..9e1b02a71e32 100644 --- a/jvm-packages/xgboost4j-example/src/main/scala/ml/dmlc/xgboost4j/scala/example/spark/SparkMLlibPipeline.scala +++ b/jvm-packages/xgboost4j-example/src/main/scala/ml/dmlc/xgboost4j/scala/example/spark/SparkMLlibPipeline.scala @@ -31,7 +31,7 @@ object SparkMLlibPipeline { def main(args: Array[String]): Unit = { - if (args.length != 1) { + if (args.length != 3) { println("Usage: SparkMLlibPipeline input_path native_model_path pipeline_model_path") sys.exit(1) } @@ -79,6 +79,8 @@ object SparkMLlibPipeline { "num_workers" -> 2 ) ) + booster.setFeaturesCol("features") + booster.setLabelCol("classIndex") val labelConverter = new IndexToString() .setInputCol("prediction") .setOutputCol("realLabel") @@ -94,6 +96,8 @@ object SparkMLlibPipeline { // Model evaluation val evaluator = new MulticlassClassificationEvaluator() + evaluator.setLabelCol("classIndex") + evaluator.setPredictionCol("prediction") val accuracy = evaluator.evaluate(prediction) println("The model accuracy is : " + accuracy) diff --git a/src/tree/updater_histmaker.cc b/src/tree/updater_histmaker.cc index 7c67afe93f2b..b64a7d3071a6 100644 --- a/src/tree/updater_histmaker.cc +++ b/src/tree/updater_histmaker.cc @@ -36,7 +36,7 @@ class HistMaker: public BaseMaker { } protected: - /*! \brief a single histogram */ + /*! \brief a single histogram */ struct HistUnit { /*! \brief cutting point of histogram, contains maximum point */ const bst_float *cut;