Skip to content
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
30 changes: 29 additions & 1 deletion python/pyspark/ml/fpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,32 @@ def getMinSupport(self):
return self.getOrDefault(self.minSupport)


class HasNumPartitions(Params):
"""
Mixin for param numPartitions: Number of partitions (at least 1) used by parallel FP-growth.
"""

numPartitions = Param(
Params._dummy(),
"numPartitions",
"Number of partitions (at least 1) used by parallel FP-growth. " +
"By default the param is not set, " +
"and partition number of the input dataset is used.",
typeConverter=TypeConverters.toInt)

def setNumPartitions(self, value):
"""
Sets the value of :py:attr:`numPartitions`.
"""
return self._set(numPartitions=value)

def getNumPartitions(self):
"""
Gets the value of :py:attr:`numPartitions` or its default value.
"""
return self.getOrDefault(self.numPartitions)


class HasMinConfidence(Params):
"""
Mixin for param minConfidence.
Expand Down Expand Up @@ -127,7 +153,9 @@ def associationRules(self):


class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
HasMinSupport, HasMinConfidence, JavaMLWritable, JavaMLReadable):
HasMinSupport, HasNumPartitions, HasMinConfidence,
JavaMLWritable, JavaMLReadable):

"""
.. note:: Experimental

Expand Down