Skip to content

Commit 85882ae

Browse files
committed
ENH: add numPartitions
1 parent 0f2f56c commit 85882ae

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

python/pyspark/ml/fpm.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@ def getMinSupport(self):
4949
return self.getOrDefault(self.minSupport)
5050

5151

52+
class HasNumPartitions(Params):
53+
"""
54+
Mixin for param support.
55+
"""
56+
57+
numPartitions = Param(
58+
Params._dummy(),
59+
"numPartitions",
60+
"""Number of partitions (at least 1) used by parallel FP-growth.
61+
By default the param is not set,
62+
and partition number of the input dataset is used.""",
63+
typeConverter=TypeConverters.toInt)
64+
65+
def setNumPartitions(self, value):
66+
"""
67+
Sets the value of :py:attr:`numPartitions`.
68+
"""
69+
return self._set(numPartitions=value)
70+
71+
def getNumPartitions(self):
72+
"""
73+
Gets the value of numPartitions or its default value.
74+
"""
75+
return self.getOrDefault(self.numPartitions)
76+
77+
5278
class HasConfidence(Params):
5379
"""
5480
Mixin for param confidence.
@@ -126,7 +152,8 @@ def associationRules(self):
126152

127153

128154
class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
129-
HasSupport, HasConfidence, JavaMLWritable, JavaMLReadable):
155+
HasSupport, HasNumPartitions, HasConfidence,
156+
JavaMLWritable, JavaMLReadable):
130157
"""
131158
.. note:: Experimental
132159

0 commit comments

Comments
 (0)