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

    https://github.com/apache/spark/pull/17218#discussion_r107758576
  
    --- Diff: python/pyspark/ml/fpm.py ---
    @@ -0,0 +1,211 @@
    +#
    +# 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
    +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:
    +            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]",
    +        typeConverter=TypeConverters.toFloat)
    +
    +    def setMinConfidence(self, value):
    +        """
    +        Sets the value of :py:attr:`minConfidence`.
    +        """
    +        if not 0 <= value <= 1:
    +            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 __init__(self):
    +        super(HasItemsCol, self).__init__()
    +        self._setDefault(itemsCol='items')
    +
    +    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):
    +    """Model fitted by FPGrowth.
    +
    +    .. 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`)."""
    +        return self._call_java("associationRules")
    +
    +
    +class FPGrowth(JavaEstimator, HasItemsCol, HasPredictionCol,
    --- End diff --
    
    Mark Experimental


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to