Class AlgoFPGrowth


  • public class AlgoFPGrowth
    extends java.lang.Object
    This is an implementation of the FPGROWTH algorithm (Han et al., 2004). FPGrowth is described here:

    Han, J., Pei, J., & Yin, Y. (2000, May). Mining frequent patterns without candidate generation. In ACM SIGMOD Record (Vol. 29, No. 2, pp. 1-12). ACM

    This is an optimized version that saves the result to a file or keep it into memory if no output path is provided by the user to the runAlgorithm method().
    Author:
    Philippe Fournier-Viger
    See Also:
    FPTree, Itemset, Itemsets
    • Constructor Summary

      Constructors 
      Constructor Description
      AlgoFPGrowth​(int oddDistance)  
      AlgoFPGrowth​(int i, int minSupport)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDatabaseSize()
      Get the number of transactions in the last transaction database read.
      void printStats()
      Print statistics about the algorithm execution to System.out.
      Itemsets runAlgorithm​(java.lang.String input, java.lang.String output, double minsupp)  
      Itemsets runAlgorithm​(FPTree tree, int logSize, java.util.HashMap<java.lang.Integer,​java.lang.Integer> mapSupport, java.util.HashMap<java.lang.Integer,​java.util.List<java.lang.Integer>> mapTraceList, java.util.List<java.lang.Integer> mapTraces)
      Method to run the FPGRowth algorithm.
      void setMaximumPatternLength​(int length)
      Set the maximum pattern length
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • minSupportRelative

        public int minSupportRelative
    • Constructor Detail

      • AlgoFPGrowth

        public AlgoFPGrowth​(int i,
                            int minSupport)
        Constructor
        Parameters:
        minSupport -
        i -
      • AlgoFPGrowth

        public AlgoFPGrowth​(int oddDistance)
    • Method Detail

      • runAlgorithm

        public Itemsets runAlgorithm​(FPTree tree,
                                     int logSize,
                                     java.util.HashMap<java.lang.Integer,​java.lang.Integer> mapSupport,
                                     java.util.HashMap<java.lang.Integer,​java.util.List<java.lang.Integer>> mapTraceList,
                                     java.util.List<java.lang.Integer> mapTraces)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
        Method to run the FPGRowth algorithm.
        Parameters:
        mapTraceList -
        mapTraces -
        input - the path to an input file containing a transaction database.
        output - the output file path for saving the result (if null, the result will be returned by the method instead of being saved).
        minsupp - the minimum support threshold.
        Returns:
        the result if no output file path is provided.
        Throws:
        java.io.IOException - exception if error reading or writing files
        java.io.FileNotFoundException
      • runAlgorithm

        public Itemsets runAlgorithm​(java.lang.String input,
                                     java.lang.String output,
                                     double minsupp)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • printStats

        public void printStats()
        Print statistics about the algorithm execution to System.out.
      • getDatabaseSize

        public int getDatabaseSize()
        Get the number of transactions in the last transaction database read.
        Returns:
        the number of transactions.
      • setMaximumPatternLength

        public void setMaximumPatternLength​(int length)
        Set the maximum pattern length
        Parameters:
        length - the maximum length