Skip to content

Instantly share code, notes, and snippets.

@abhijeet-talaulikar
Created October 27, 2021 22:01
Show Gist options
  • Save abhijeet-talaulikar/5ffe52ae2a27ebce522ac4c5717792a6 to your computer and use it in GitHub Desktop.
Save abhijeet-talaulikar/5ffe52ae2a27ebce522ac4c5717792a6 to your computer and use it in GitHub Desktop.
get_one_itemsets.py
def get_one_itemsets(transaction_db, min_sup):
items = {}
for t_tup in transaction_db.list_items:
for i in new_t:
if i in items.keys():
items[i] += t_tup[1]
else:
items[i] = t_tup[1]
# Eliminate one itemsets which do not meet minimum support criteria
items = {i:sup for (i,sup) in items.items() if sup >= min_sup}
return items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment