diff --git a/mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala b/mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala index f3a575348419f..ac498ba716987 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala @@ -21,6 +21,9 @@ import java.lang.{Iterable => JIterable} import scala.collection.JavaConverters._ +import org.json4s.JsonDSL._ +import org.json4s.jackson.JsonMethods._ + import org.apache.spark.{Logging, SparkContext, SparkException} import org.apache.spark.annotation.Since import org.apache.spark.mllib.linalg.{BLAS, DenseMatrix, DenseVector, SparseVector, Vector} @@ -28,8 +31,6 @@ import org.apache.spark.mllib.regression.LabeledPoint import org.apache.spark.mllib.util.{Broadcastable, Loader, Saveable} import org.apache.spark.rdd.RDD import org.apache.spark.sql.{DataFrame, SQLContext} -import org.json4s.JsonDSL._ -import org.json4s.jackson.JsonMethods._ /** * Model for Naive Bayes Classifiers. diff --git a/mllib/src/main/scala/org/apache/spark/mllib/util/ModelBroadcast.scala b/mllib/src/main/scala/org/apache/spark/mllib/util/Broadcastable.scala similarity index 92% rename from mllib/src/main/scala/org/apache/spark/mllib/util/ModelBroadcast.scala rename to mllib/src/main/scala/org/apache/spark/mllib/util/Broadcastable.scala index 4aa81423e6310..b8bb3eb8b9874 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/util/ModelBroadcast.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/util/Broadcastable.scala @@ -29,6 +29,8 @@ private[spark] trait Broadcastable[T] { /** * Checks whether the model object is already broadcast and returns the reference. * If not, then broadcasts the model and returns a reference + * This is done to prevent the rebroadcasting of model during prediction and should + * only be mixed in with a model attribute. * @param sc SparkContext that will be used for the broadcast * @param modelToBc Model object to broadcast * @return the broadcast model