Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-10275][MLlib] Add @since annotation to pyspark.mllib.random #8666

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions python/pyspark/mllib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from functools import wraps

from pyspark import since
from pyspark.mllib.common import callMLlibFunc


Expand All @@ -39,9 +40,12 @@ class RandomRDDs(object):
"""
Generator methods for creating RDDs comprised of i.i.d samples from
some distribution.

.. addedversion:: 1.1.0
"""

@staticmethod
@since("1.1.0")
def uniformRDD(sc, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the
Expand Down Expand Up @@ -72,6 +76,7 @@ def uniformRDD(sc, size, numPartitions=None, seed=None):
return callMLlibFunc("uniformRDD", sc._jsc, size, numPartitions, seed)

@staticmethod
@since("1.1.0")
def normalRDD(sc, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the standard normal
Expand Down Expand Up @@ -100,6 +105,7 @@ def normalRDD(sc, size, numPartitions=None, seed=None):
return callMLlibFunc("normalRDD", sc._jsc, size, numPartitions, seed)

@staticmethod
@since("1.3.0")
def logNormalRDD(sc, mean, std, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the log normal
Expand Down Expand Up @@ -132,6 +138,7 @@ def logNormalRDD(sc, mean, std, size, numPartitions=None, seed=None):
size, numPartitions, seed)

@staticmethod
@since("1.1.0")
def poissonRDD(sc, mean, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the Poisson
Expand All @@ -158,6 +165,7 @@ def poissonRDD(sc, mean, size, numPartitions=None, seed=None):
return callMLlibFunc("poissonRDD", sc._jsc, float(mean), size, numPartitions, seed)

@staticmethod
@since("1.3.0")
def exponentialRDD(sc, mean, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the Exponential
Expand All @@ -184,6 +192,7 @@ def exponentialRDD(sc, mean, size, numPartitions=None, seed=None):
return callMLlibFunc("exponentialRDD", sc._jsc, float(mean), size, numPartitions, seed)

@staticmethod
@since("1.3.0")
def gammaRDD(sc, shape, scale, size, numPartitions=None, seed=None):
"""
Generates an RDD comprised of i.i.d. samples from the Gamma
Expand Down Expand Up @@ -216,6 +225,7 @@ def gammaRDD(sc, shape, scale, size, numPartitions=None, seed=None):

@staticmethod
@toArray
@since("1.1.0")
def uniformVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand All @@ -241,6 +251,7 @@ def uniformVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None):

@staticmethod
@toArray
@since("1.1.0")
def normalVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand All @@ -266,6 +277,7 @@ def normalVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None):

@staticmethod
@toArray
@since("1.3.0")
def logNormalVectorRDD(sc, mean, std, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand Down Expand Up @@ -300,6 +312,7 @@ def logNormalVectorRDD(sc, mean, std, numRows, numCols, numPartitions=None, seed

@staticmethod
@toArray
@since("1.1.0")
def poissonVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand Down Expand Up @@ -330,6 +343,7 @@ def poissonVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=None):

@staticmethod
@toArray
@since("1.3.0")
def exponentialVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand Down Expand Up @@ -360,6 +374,7 @@ def exponentialVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=No

@staticmethod
@toArray
@since("1.3.0")
def gammaVectorRDD(sc, shape, scale, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
Expand Down