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

    https://github.com/apache/spark/pull/135#discussion_r10580163
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -310,6 +310,9 @@ abstract class RDD[T: ClassTag](
        * Return a sampled subset of this RDD.
        */
       def sample(withReplacement: Boolean, fraction: Double, seed: Int): 
RDD[T] = {
    +    if (fraction < Double.MinValue  || fraction > Double.MaxValue) {
    --- End diff --
    
    Hi, @rxin , I'm also a bit confused here, I think the name of the argument 
is a bit confusing
    
    
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/RDD.scala#L357
    
    The above line contains a multiplier to ensure that the sampling can return 
enough sample points in most of cases..(I think so), so the fraction value can 
actually be larger than 1
    
    also, this value actually determines the mean value of Poisson/Bernoulli 
distribution 
    
    
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/RDD.scala#L314


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to