Professional Documents
Culture Documents
Experiment No - 4
Aim: Implement Apriority algorithm of association rule data mining technique in any Programming
language.
Date:
Objectives: To implement basic logic for association rule mining algorithm with support and
confidence measures.
.
Equipment/Instruments: Personal Computer, open-source software for programming
Program:
Implement Apriori algorithm of association rule data mining technique in any Programming
language.
Code:
# Define the dataset transactions = [
["I1","I2","I5"],
["I2","I4"],["I2","I3"],["I1","I2","I4"],["I1","I3"],
["I2","I3"],["I1","I3"],
["I1","I2","I3","I5"],
["I1","I2","I3"]
]
19
Data Mining (3160714) 200170107063
candidate_itemsets = frequent_itemsets.keys()
# Calculate support for candidate itemsets and remove those that don't meet minimum support threshold
itemset_counts = {itemset: 0 for itemset in candidate_itemsets} for transaction in transactions:
for itemset in itemset_counts.keys(): if itemset.issubset(transaction):
itemset_counts[itemset] += 1 frequent_itemsets.update({itemset: count for itemset, count in
itemset_counts.items() if count >= min_support})
# Increment k k += 1
Observations:
20
Data Mining (3160714) 200170107063
Conclusion:
Apriority algorithm is an effective and widely used approach for discovering frequent itemsets and
association rules in large transaction datasets. It has been used in various applications such as market
basket analysis, customer segmentation, and web usage mining.
Quiz:
Suggested Reference:
Problem Completeness
Knowledge Logic
Recognition and accuracy Ethics (2)
Rubrics (2) Building (2) Total
(2) (2)
Good Average Good Average Good Average Good Average Good Average
(2) (1) (2) (1) (2) (1) (2) (1) (2) (1)
Marks
21