Class RulesGenerator


  • public final class RulesGenerator
    extends Object
    Generate association rules from frequent item sets. The algorithm is based on total support trees as described in the paper: "Algorithms for Computing Association Rules Using a Partial-Support Tree".

    The items within each frequent set are inserted into a tree in reverse order, based on the index of the item. Once all item sets are inserted, the tree is mined from the root downwards. Antecedents and consequents are generated based on the current path of the tree. The path must meet the minimum support and the generated sets must meet the minimum confidence.

    • Constructor Detail

      • RulesGenerator

        public RulesGenerator()
    • Method Detail

      • addItemSet

        public void addItemSet​(ItemSet itemSet)
        Add an item set to the model used by the rules generator.
        Parameters:
        itemSet - a frequent item set
      • generateRules

        public void generateRules​(long minSupport,
                                  long txnCount,
                                  double minConfidence)
        Generate the association rules given the minimum support and minimum confidence constraints. Start with the root nodes of the tree and work towards the leaf nodes. Create item sets from these "paths" and determine if the sets meet minimum thresholds. If they do, then create association rules from these discovered sets.
        Parameters:
        minSupport - minimum number of transactions to meet support
        txnCount - total number of transactions of the input data set
        minConfidence - minimum confidence a rule must meet to be considered
      • dispose

        public void dispose()
        Dispose of any memory consumed by the rules generator.
      • getGeneratedRules

        public List<AssociationRule> getGeneratedRules()
        Return the list of rules generated.
        Returns:
        generated association rules