Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7672#discussion_r35880303
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/NaiveBayes.scala ---
    @@ -129,29 +129,49 @@ class NaiveBayesModel private[ml] (
           throw new UnknownError(s"Invalid modelType: ${$(modelType)}.")
       }
     
    -  override protected def predict(features: Vector): Double = {
    +  override val numClasses: Int = pi.size
    +
    +  private def posteriorProbabilities(logProb: DenseVector) = {
    --- End diff --
    
    Yes, posteriorProbabilities is easy to reuse, but  it not easy to directly 
reuse multinomialCalculation, and bernoulliCalculation because the 
mllib.NaiveBayesModel and ml.NaiveBayesModel has different model parameters.
    ```java
    class NaiveBayesModel private[ml] (
        override val uid: String,
        val pi: Vector,
        val theta: Matrix)
    ```


---
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]

Reply via email to