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

    https://github.com/apache/spark/pull/916#discussion_r13212134
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -421,6 +431,22 @@ abstract class RDD[T: ClassTag](
         Utils.randomizeInPlace(samples, rand).take(total)
       }
     
    +  private[spark] def computeFraction(num: Int, total: Long, 
withReplacement: Boolean) : Double = {
    +    val fraction = num.toDouble / total
    +    if (withReplacement) {
    +      var numStDev = 5
    +      if (num < 12) {
    +        // special case to guarantee sample size for small s
    +        numStDev = 9
    +      }
    +      fraction + numStDev * math.sqrt(fraction / total)
    +    } else {
    +      val delta = 0.00005
    --- End diff --
    
    actually success rate = 1-2*delta, so 0.00005 gives 99.99% success rate, 
consistent with the poisson success rate.


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

Reply via email to