Python
Python
dataset =
['Milk', 'Onion", 'Nutmeg', 'Kidney Beans", 'Eggs", 'Yogurt'],
['Dill', 'Onion", 'Nutmeg", 'Kidney Beans", 'Eggs", 'Yogurt'],
['Milk", 'Apple", 'Kidney Beans", 'Eggs'],
['Milk", 'Unicorn", 'Corn", 'Kidney Beans", 'Yogurt'],
['Corn', 'Onion', 'Onion', 'Kidney Beans', 'Ice cream', 'Eggs']
# Assuming your dataset is a List of Lists where each inner List is a transaction
# If not, you might need to preprocess your data to get it in this format
print(frequent_itemsets)
support itemsets
0 0.8 (Eggs)
1 1.0 (Kidney Beans)
2 0.6 (Milk)
3 0.6 (Onion)
4 0.6 (Yogurt)
5 0.8 (Eggs, Kidney Beans)
6 0.6 (Eggs, Onion)
7 0.6 (Milk, Kidney Beans)
8 0.6 (Kidney Beans, Onion)
9 0.6 (Yogurt, Kidney Beans)
10 0.6 (Eggs, Kidney Beans, Onion)
In [ ] :
1/1