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

    https://github.com/apache/spark/pull/6761#discussion_r32914016
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala
 ---
    @@ -116,6 +116,92 @@ class NaiveBayesSuite extends SparkFunSuite with 
MLlibTestSparkContext {
         }
       }
     
    +  def validatePredictionsProbabilities(predictionsProbabilities: 
Seq[Array[Double]],
    +                                       input: Seq[LabeledPoint],
    +                                       modelType: String = Multinomial) = {
    +    predictionsProbabilities.foreach { probabilities =>
    +      val sum = probabilities.sum
    +      // Check that prediction probabilities sum up to one
    +      // with an epsilon of 10^-2
    +      assert(sum > 0.99 && sum < 1.01)
    --- End diff --
    
    We have a syntax like `assert(sum ~== 1.0 relTol 0.01)` for this. I think 
the bound should be tighter here. I would not expect probabilities to be 1.001 
or 1.0001.


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