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

    https://github.com/apache/spark/pull/1520#discussion_r15266943
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/random/RandomRDDGenerators.scala ---
    @@ -0,0 +1,235 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.mllib.random
    +
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.rdd.{RandomVectorRDD, RandomRDD}
    +import org.apache.spark.rdd.RDD
    +import org.apache.spark.util.Utils
    +
    +// TODO add Scaladocs once API fully approved
    +// Alternatively, we can use the generator pattern to set numPartitions, 
seed, etc instead to bring
    +// down the number of methods here.
    +object RandomRDDGenerators {
    +
    +  def uniformRDD(sc: SparkContext, size: Long, numPartitions: Int, seed: 
Long): RDD[Double] = {
    +    val uniform = new UniformGenerator()
    +    randomRDD(sc, size, numPartitions, uniform, seed)
    +  }
    +
    +  def uniformRDD(sc: SparkContext, size: Long, seed: Long): RDD[Double] = {
    +    uniformRDD(sc, size, sc.defaultParallelism, seed)
    +  }
    +
    +  def uniformRDD(sc: SparkContext, size: Long, numPartitions: Int): 
RDD[Double] = {
    +    uniformRDD(sc, size, numPartitions, Utils.random.nextLong)
    +  }
    +
    +  def uniformRDD(sc: SparkContext, size: Long): RDD[Double] = {
    +    uniformRDD(sc, size, sc.defaultParallelism, Utils.random.nextLong)
    +  }
    +
    +  def normalRDD(sc: SparkContext, size: Long, numPartitions: Int, seed: 
Long): RDD[Double] = {
    +    val normal = new StandardNormalGenerator()
    +    randomRDD(sc, size, numPartitions, normal, seed)
    +  }
    +
    +  def normalRDD(sc: SparkContext, size: Long, seed: Long): RDD[Double] = {
    +    normalRDD(sc, size, sc.defaultParallelism, seed)
    +  }
    +
    +  def normalRDD(sc: SparkContext, size: Long, numPartitions: Int): 
RDD[Double] = {
    +    normalRDD(sc, size, numPartitions, Utils.random.nextLong)
    +  }
    +
    +  def normalRDD(sc: SparkContext, size: Long): RDD[Double] = {
    +    normalRDD(sc, size, sc.defaultParallelism, Utils.random.nextLong)
    +  }
    +
    +  def poissonRDD(sc: SparkContext,
    +      size: Long,
    +      numPartitions: Int,
    +      mean: Double,
    +      seed: Long): RDD[Double] = {
    +    val poisson = new PoissonGenerator(mean)
    +    randomRDD(sc, size, numPartitions, poisson, seed)
    +  }
    +
    +  def poissonRDD(sc: SparkContext, size: Long, mean: Double, seed: Long): 
RDD[Double] = {
    +    poissonRDD(sc, size, sc.defaultParallelism, mean, seed)
    +  }
    +
    +  def poissonRDD(sc: SparkContext, size: Long, numPartitions: Int, mean: 
Double): RDD[Double] = {
    +    poissonRDD(sc, size, numPartitions, mean, Utils.random.nextLong)
    +  }
    +
    +  def poissonRDD(sc: SparkContext, size: Long, mean: Double): RDD[Double] 
= {
    +    poissonRDD(sc, size, sc.defaultParallelism, mean, 
Utils.random.nextLong)
    +  }
    +
    +  def randomRDD(sc: SparkContext,
    +      size: Long,
    +      numPartitions: Int,
    +      distribution: DistributionGenerator,
    --- End diff --
    
    copypasta fail. meant to change all of them to `rng`.


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