From 852c5a4b32fed4a73a4107ffbfc2e10d3ee95a82 Mon Sep 17 00:00:00 2001 From: CodingCat Date: Wed, 9 Mar 2016 10:30:44 -0500 Subject: [PATCH] code formatting in XGBoostModel --- .../dmlc/xgboost4j/scala/spark/XGBoostModel.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostModel.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostModel.scala index 3117f47a1..88b881cd4 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostModel.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostModel.scala @@ -26,12 +26,11 @@ import ml.dmlc.xgboost4j.scala.{DMatrix, Booster} class XGBoostModel(booster: Booster)(implicit val sc: SparkContext) extends Serializable { /** - * Predict result with the given testset (represented as RDD) - */ + * Predict result with the given testset (represented as RDD) + */ def predict(testSet: RDD[Vector]): RDD[Array[Array[Float]]] = { import DataUtils._ val broadcastBooster = testSet.sparkContext.broadcast(booster) - val dataUtils = testSet.sparkContext.broadcast(DataUtils) testSet.mapPartitions { testSamples => val dMatrix = new DMatrix(new JDMatrix(testSamples, null)) Iterator(broadcastBooster.value.predict(dMatrix)) @@ -46,10 +45,10 @@ class XGBoostModel(booster: Booster)(implicit val sc: SparkContext) extends Seri } /** - * Save the model as to HDFS-compatible file system. - * - * @param modelPath The model path as in Hadoop path. - */ + * Save the model as to HDFS-compatible file system. + * + * @param modelPath The model path as in Hadoop path. + */ def saveModelToHadoop(modelPath: String): Unit = { val outputStream = FileSystem.get(sc.hadoopConfiguration).create(new Path(modelPath)) booster.saveModel(outputStream)