MLT
MLT
Implement Apriori and FP-growth algorithm to find all frequent item sets for the chosen dataset and
also generate Association Rules.
Objective:
A supermarket wants to analyze customer purchase patterns to optimize product placement and run
targeted promotions. The goal is to identify frequent item sets and association rules among purchased
products.
Implementation:
The supermarket has a transaction history that includes the items purchased by customers. Using the FB
Growth algorithm and association rule mining, the supermarket aims to discover patterns of products
that are frequently bought together.
FP-Growth:
Algorithm:
Click ->Import-> select from My computer and load, Save under Local Repository
Apriori
Algorithm:
transactions = [
data = pd.DataFrame([
{'A': 'A' in t, 'B': 'B' in t, 'C': 'C' in t, 'D': 'D' in t, 'E': 'E' in t}
for t in transactions
])
# Display results
print("Frequent Itemsets:")
print(frequent_itemsets)
print("\nAssociation Rules:")
print(rules)
Result:
Thus the FP-Growth and Apriori algorithm to find all frequent item sets were implemented successfully.