Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17218#discussion_r108048733
  
    --- Diff: python/pyspark/ml/fpm.py ---
    @@ -0,0 +1,232 @@
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#    http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +from pyspark import keyword_only, since
    +from pyspark.ml.util import *
    +from pyspark.ml.wrapper import JavaEstimator, JavaModel
    +from pyspark.ml.param.shared import *
    +
    +__all__ = ["FPGrowth", "FPGrowthModel"]
    +
    +
    +class HasSupport(Params):
    +    """
    +    Mixin for param support: [0.0, 1.0].
    +    """
    +
    +    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",
    +        typeConverter=TypeConverters.toFloat)
    +
    +    def setMinSupport(self, value):
    +        """
    +        Sets the value of :py:attr:`minSupport`.
    +        """
    +        if not (0 <= value <= 1):
    +            raise ValueError("Support must be in range [0, 1]")
    +        return self._set(minSupport=value)
    +
    +    def getMinSupport(self):
    +        """
    +        Gets the value of minSupport or its default value.
    +        """
    +        return self.getOrDefault(self.minSupport)
    +
    +
    +class HasConfidence(Params):
    +    """
    +    Mixin for param confidence: [0.0, 1.0].
    +    """
    +
    +    minConfidence = Param(
    +        Params._dummy(),
    +        "minConfidence",
    +        """"Minimal confidence for generating Association Rule. [0.0, 1.0]
    +        Note that minConfidence has no effect during fitting.""",
    +        typeConverter=TypeConverters.toFloat)
    +
    +    def setMinConfidence(self, value):
    +        """
    +        Sets the value of :py:attr:`minConfidence`.
    +        """
    +        if not (0 <= value <= 1):
    +            raise ValueError("Confidence must be in range [0, 1]")
    +        return self._set(minConfidence=value)
    +
    +    def getMinConfidence(self):
    +        """
    +        Gets the value of minConfidence or its default value.
    +        """
    +        return self.getOrDefault(self.minConfidence)
    +
    +
    +class HasItemsCol(Params):
    +    """
    +    Mixin for param itemsCol: items column name.
    +    """
    +
    +    itemsCol = Param(Params._dummy(), "itemsCol",
    +                     "items column name", 
typeConverter=TypeConverters.toString)
    +
    +    def setItemsCol(self, value):
    +        """
    +        Sets the value of :py:attr:`itemsCol`.
    +        """
    +        return self._set(itemsCol=value)
    +
    +    def getItemsCol(self):
    +        """
    +        Gets the value of itemsCol or its default value.
    +        """
    +        return self.getOrDefault(self.itemsCol)
    +
    +
    +class FPGrowthModel(JavaModel, JavaMLWritable, JavaMLReadable,
    +                    HasConfidence, HasItemsCol, HasPredictionCol):
    +    """Model fitted by FPGrowth.
    +
    +    .. note:: Experimental
    +
    +    .. versionadded:: 2.2.0
    +    """
    +    @property
    +    @since("2.2.0")
    +    def freqItemsets(self):
    +        """
    +        DataFrame with two columns:
    +        * `items` - Itemset of the same type as the input column.
    +        * `freq`  - Frequency of the itemset (`LongType`).
    +        """
    +        return self._call_java("freqItemsets")
    +
    +    @property
    +    @since("2.2.0")
    +    def associationRules(self):
    +        """
    +        Data with three columns:
    +        * `antecedent`  - Array of the same type as the input column.
    +        * `consequent`  - Single element array of the same type as the 
input column.
    +        * `confidence`  - Confidence for the rule (`DoubleType`).
    +        """
    +        self._transfer_params_to_java()
    +        return self._call_java("associationRules")
    +
    +    @keyword_only
    +    @since("2.2.0")
    +    def setParams(self, minConfidence=0.8, itemsCol="items", 
predictionCol="prediction"):
    +        """
    +        setParams(self, minConfidence=0.8, itemsCol="items", 
predictionCol="prediction")
    +        """
    +        kwargs = self._input_kwargs
    +        return self._set(**kwargs)
    +
    +
    +class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
    +               HasSupport, HasConfidence, JavaMLWritable, JavaMLReadable):
    +    """A parallel FP-growth algorithm to mine frequent itemsets. The 
algorithm is described in
    +    Li et al., PFP: Parallel FP-Growth for Query Recommendation [LI2008]_.
    +    PFP distributes computation in such a way that each worker executes an
    +    independent group of mining tasks. The FP-Growth algorithm is 
described in
    +    Han et al., Mining frequent patterns without candidate generation 
[HAN2000]_
    +
    +    .. [LI2008] http://dx.doi.org/10.1145/1454008.1454027
    +    .. [HAN2000] http://dx.doi.org/10.1145/335191.335372
    +
    +    .. note:: Experimental
    --- End diff --
    
    I didn't see this before, so now this is noted twice.  Just put it once at 
the beginning of the docstring.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to