zhengruifeng commented on a change in pull request #26679: [SPARK-30044][ML]
MNB/CNB/BNB use empty sigma matrix instead of null
URL: https://github.com/apache/spark/pull/26679#discussion_r351564707
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/classification/NaiveBayes.scala
##########
@@ -590,21 +588,17 @@ object NaiveBayesModel extends
MLReadable[NaiveBayesModel] {
instance.getModelType match {
case Multinomial | Bernoulli | Complement =>
- // Save model data: pi, theta
- require(instance.sigma == null)
- val data = Data(instance.pi, instance.theta)
-
sparkSession.createDataFrame(Seq(data)).repartition(1).write.parquet(dataPath)
-
+ require(instance.sigma.numRows == 0 && instance.sigma.numCols == 0)
Review comment:
Yes, it is all new, the matrix `sigma` is just added in
https://github.com/apache/spark/pull/26413 last week.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]