Class FPGrowth

  • All Implemented Interfaces:
    LogicalOperator, RecordSinkOperator, SinkOperator<RecordPort>, Serializable

    public class FPGrowth
    extends CompositeOperator
    implements Serializable, RecordSinkOperator
    An operator that implements the FP-growth algorithm, outputting a PMML model containing generated items sets and association rules.

    The input data is required to have two fields: a transaction identifier and an item identifier. The transaction identifier discriminates transactions. The item identifier identifies items within transactions. Transactions are assumed to be in line item order (i.e. one input record per item in a transaction). Transactions records are also assumed to be contiguous. An optional label field may also be specified which will be used for display purposes instead of the transaction identifiers.

    The output is a PMML based association model. The model contains frequent items, frequent item sets and association rules.

    See Also:
    Serialized Form
    • Constructor Detail

      • FPGrowth

        public FPGrowth()
    • Method Detail

      • getTxnFieldName

        public String getTxnFieldName()
        Get the transaction identifier field name property.
        Returns:
        transaction field name
      • setTxnFieldName

        public void setTxnFieldName​(String txnFieldName)
        Set the transaction identifier field name property.
        Parameters:
        txnFieldName - transaction field name
      • getItemFieldName

        public String getItemFieldName()
        Get the item field name property.
        Returns:
        item field name
      • setItemFieldName

        public void setItemFieldName​(String itemFieldName)
        Set the item field name property.
        Parameters:
        itemFieldName - item field name
      • getLabelFieldName

        public String getLabelFieldName()
        Get the optional label field name property.
        Returns:
        label field name
      • setLabelFieldName

        public void setLabelFieldName​(String labelFieldName)
        Set the optional label field name property.
        Parameters:
        labelFieldName - label field name
      • getMinSupport

        public double getMinSupport()
        Get the minimum support property.
        Returns:
        minimum support
      • setMinSupport

        public void setMinSupport​(double minSupport)
        Set the minimum support property. This property is a floating point number between 0 and 1 (exclusive) that defines the percentage of transactions an item must participate in to be considered frequent.
        Parameters:
        minSupport - minimum support
      • getK

        public int getK()
        Get the item-set cardinality property.
        Returns:
        item-set cardinality
      • setK

        public void setK​(int k)
        Set the largest item-set cardinality wanted. The default value is zero, which implies that all cardinality item-sets should be discovered.
        Parameters:
        k - the largest item-set cardinality wanted
      • getMinConfidence

        public double getMinConfidence()
        Get the minimum confidence property.
        Returns:
        minimum confidence
      • setMinConfidence

        public void setMinConfidence​(double minConfidence)
        Set the minimum confidence threshold.

        The minimum confidence value must be between 0.0 and 1.0 (exclusively).

        Parameters:
        minConfidence - the minConfidence value to set
      • getAnnotationText

        public String getAnnotationText()
        Get the annotation text property.
        Returns:
        annotation text
      • setAnnotationText

        public void setAnnotationText​(String annotationText)
        The text provided will be added as an annotation to the output PMML model. This can be used to tag a model for later reference. This is opaque text added to the annotation element within the model.
        Parameters:
        annotationText - annotation text
      • getModel

        public PMMLPort getModel()
        Get the output port containing the generated PMML-based association model.
        Returns:
        output model port
      • getItemSets

        public RecordPort getItemSets()
        Get the output port containing the frequent item sets.
        Returns:
        output port containing frequent item sets
      • compose

        protected void compose​(CompositionContext ctx)
        Description copied from class: CompositeOperator
        Compose the body of this operator. Implementations should do the following:
        1. Perform any validation of configuration, input types, etc
        2. Instantiate and configure sub-operators, adding them to the provided context via the method OperatorComposable.add(O)
        3. Create necessary connections via the method OperatorComposable.connect(P, P). This includes connections from the composite's input ports to sub-operators, connections between sub-operators, and connections from sub-operators output ports to the composite's output ports
        Specified by:
        compose in class CompositeOperator
        Parameters:
        ctx - the context