Skip to content

[SPARK-19281][FOLLOWUP][ML] Minor fix for PySpark FPGrowth. #18089

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

Closed
wants to merge 1 commit 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
21 changes: 11 additions & 10 deletions python/pyspark/ml/fpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
__all__ = ["FPGrowth", "FPGrowthModel"]


class HasSupport(Params):
class HasMinSupport(Params):
"""
Mixin for param support.
Mixin for param minSupport.
"""

minSupport = Param(
Params._dummy(),
"minSupport",
"""Minimal support level of the frequent pattern. [0.0, 1.0].
Any pattern that appears more than (minSupport * size-of-the-dataset)
times will be output""",
"Minimal support level of the frequent pattern. [0.0, 1.0]. " +
"Any pattern that appears more than (minSupport * size-of-the-dataset) " +
"times will be output in the frequent itemsets.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note there will be \n in the generated Python API docs if using """.

Before this PR:
image

After this PR:
image

typeConverter=TypeConverters.toFloat)

def setMinSupport(self, value):
Expand All @@ -49,16 +49,17 @@ def getMinSupport(self):
return self.getOrDefault(self.minSupport)


class HasConfidence(Params):
class HasMinConfidence(Params):
"""
Mixin for param confidence.
Mixin for param minConfidence.
"""

minConfidence = Param(
Params._dummy(),
"minConfidence",
"""Minimal confidence for generating Association Rule. [0.0, 1.0]
Note that minConfidence has no effect during fitting.""",
"Minimal confidence for generating Association Rule. [0.0, 1.0]. " +
"minConfidence will not affect the mining for frequent itemsets, " +
"but will affect the association rules generation.",
typeConverter=TypeConverters.toFloat)

def setMinConfidence(self, value):
Expand Down Expand Up @@ -126,7 +127,7 @@ def associationRules(self):


class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
HasSupport, HasConfidence, JavaMLWritable, JavaMLReadable):
HasMinSupport, HasMinConfidence, JavaMLWritable, JavaMLReadable):
"""
.. note:: Experimental

Expand Down