asaini / Apriori

Python Implementation of Apriori Algorithm for finding Frequent sets and Association Rules
MIT License
771 stars 435 forks source link

no pruning in Apriori function #24

Open zoeleesss opened 6 years ago

zoeleesss commented 6 years ago

This is what we should implement in code with pruning.

  1. Let k=1
  2. Generate frequent itemsets of length k
  3. Repeat until no new frequent itemsets are identified
    • Generate length (k+1) candidate itemsets from length k frequent itemsets
    • Prune candidate itemsets containing subsets of length k+1 that are infrequent
    • Count the support of each candidate by scanning the DB
    • Eliminate candidates that are infrequent, leaving only those that are frequent
chonyy commented 4 years ago

Hi @zoeleesss , I have written one that included the pruning step that you expected. It's also a Python implementation of Apriori algorithm. Feel free to check it out! https://github.com/chonyy/apriori_python