Github user holdenk commented on a diff in the pull request:
https://github.com/apache/spark/pull/8241#discussion_r37352728
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/classification/NaiveBayes.scala ---
@@ -83,9 +86,12 @@ class NaiveBayesModel private[spark] (
}
override def predict(testData: RDD[Vector]): RDD[Double] = {
- val bcModel = testData.context.broadcast(this)
+ bcModel match {
+ case None => bcModel = Some(testData.context.broadcast(this))
+ case _ =>
+ }
testData.mapPartitions { iter =>
- val model = bcModel.value
+ val model = bcModel.get.value
--- End diff --
I believe we will still want to make a local reference to bcModel here so
we don't end up shipping the entire object across the wire.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]