Skip to content
Snippets Groups Projects
Commit c74d38fd authored by Yu ISHIKAWA's avatar Yu ISHIKAWA Committed by Xiangrui Meng
Browse files

[SPARK-10274] [MLLIB] Add @since annotation to pyspark.mllib.fpm

Author: Yu ISHIKAWA <yuu.ishikawa@gmail.com>

Closes #8665 from yu-iskw/SPARK-10274.
parent 4a0b56e8
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ import numpy ...@@ -19,7 +19,7 @@ import numpy
from numpy import array from numpy import array
from collections import namedtuple from collections import namedtuple
from pyspark import SparkContext from pyspark import SparkContext, since
from pyspark.rdd import ignore_unicode_prefix from pyspark.rdd import ignore_unicode_prefix
from pyspark.mllib.common import JavaModelWrapper, callMLlibFunc, inherit_doc from pyspark.mllib.common import JavaModelWrapper, callMLlibFunc, inherit_doc
...@@ -41,8 +41,11 @@ class FPGrowthModel(JavaModelWrapper): ...@@ -41,8 +41,11 @@ class FPGrowthModel(JavaModelWrapper):
>>> model = FPGrowth.train(rdd, 0.6, 2) >>> model = FPGrowth.train(rdd, 0.6, 2)
>>> sorted(model.freqItemsets().collect()) >>> sorted(model.freqItemsets().collect())
[FreqItemset(items=[u'a'], freq=4), FreqItemset(items=[u'c'], freq=3), ... [FreqItemset(items=[u'a'], freq=4), FreqItemset(items=[u'c'], freq=3), ...
.. versionadded:: 1.4.0
""" """
@since("1.4.0")
def freqItemsets(self): def freqItemsets(self):
""" """
Returns the frequent itemsets of this model. Returns the frequent itemsets of this model.
...@@ -55,9 +58,12 @@ class FPGrowth(object): ...@@ -55,9 +58,12 @@ class FPGrowth(object):
.. note:: Experimental .. note:: Experimental
A Parallel FP-growth algorithm to mine frequent itemsets. A Parallel FP-growth algorithm to mine frequent itemsets.
.. versionadded:: 1.4.0
""" """
@classmethod @classmethod
@since("1.4.0")
def train(cls, data, minSupport=0.3, numPartitions=-1): def train(cls, data, minSupport=0.3, numPartitions=-1):
""" """
Computes an FP-Growth model that contains frequent itemsets. Computes an FP-Growth model that contains frequent itemsets.
...@@ -74,6 +80,8 @@ class FPGrowth(object): ...@@ -74,6 +80,8 @@ class FPGrowth(object):
class FreqItemset(namedtuple("FreqItemset", ["items", "freq"])): class FreqItemset(namedtuple("FreqItemset", ["items", "freq"])):
""" """
Represents an (items, freq) tuple. Represents an (items, freq) tuple.
.. versionadded:: 1.4.0
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment