Skip to content
Snippets Groups Projects
Commit 139da116 authored by Yan Facai (颜发才)'s avatar Yan Facai (颜发才) Committed by Yanbo Liang
Browse files

[SPARK-20768][PYSPARK][ML] Expose numPartitions (expert) param of PySpark FPGrowth.

## What changes were proposed in this pull request?

Expose numPartitions (expert) param of PySpark FPGrowth.

## How was this patch tested?

+ [x] Pass all unit tests.

Author: Yan Facai (颜发才) <facai.yan@gmail.com>

Closes #18058 from facaiy/ENH/pyspark_fpg_add_num_partition.
parent 913a6bfe
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,32 @@ class HasMinSupport(Params):
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.
......@@ -127,7 +153,9 @@ class FPGrowthModel(JavaModel, JavaMLWritable, JavaMLReadable):
class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
HasMinSupport, HasMinConfidence, JavaMLWritable, JavaMLReadable):
HasMinSupport, HasNumPartitions, HasMinConfidence,
JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental
......
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