Q20Big Data Analytics
Question
Discuss the Apriori algorithm for market basket analysis.
Answer
The Apriori algorithm is used for mining frequent itemsets and learning association rules over transactional databases.
Market Basket Analysis aims to identify items that frequently co-occur in transactions (e.g., milk and bread). The Apriori algorithm uses a level-wise search to find these frequent itemsets. 1. Support: The frequency of an itemset in the dataset. Apriori sets a minimum support threshold. 2. Confidence: The likelihood that item B is purchased given that item A is purchased. 3. Apriori Principle: If an itemset is frequent, then all of its subsets must also be frequent. Conversely, if a subset is infrequent, its supersets cannot be frequent. The algorithm iteratively generates candidate itemsets of length k from frequent itemsets of length k-1, scans the database to calculate support, and prunes candidates below the threshold. In big data, Apriori can be parallelized using MapReduce or Spark to distribute the candidate generation and support counting phases across multiple nodes.