Unsupervised Learning in Data Mining: Apriori Algorithm
Unsupervised learning in data mining for rule association via the Apriori Algorithm.
Join the DZone community and get the full member experience.Join For Free
This post will share my knowledge about unsupervised learning in data mining with the simplest algorithm, which we used to generate associated rules to determine the related grocery items customers bought from our e-commerce application/retail stores.
Before jumping ahead, Let’s understand a few terms which I will be using in this article.
- Frequent itemset — Meaning items that are bought together by customers.
- Unsupervised Learning — Predict something without having prior knowledge.
- Sampling — Statistical analysis technique used to select, manipulate and analyze a representative subset of data points to identify patterns
- Noise — Meaningless information Forex. 123 in the list of groceries, which is meaningless.
- Data discretization — converting a huge number of data values into smaller ones
- Pruned — change the model by deleting the nodes/transaction
The name of the algorithm is Apriori because it uses prior knowledge of frequent itemset properties. We apply an iterative approach or level-wise search where k-frequent itemsets are used to find k+1 item sets.
To improve the efficiency of level-wise generation of frequent itemsets, an important property is used called Apriori property which helps by reducing the search space.
- Let k=1
- Generate frequent itemsets of length 1
- Repeat until no new frequent itemsets are identified
- Generate length (k+1) candidate itemsets from length k frequent itemsets
- Prune candidate itemsets containing subsets of length k that are infrequent
- Count the support of each candidate by scanning the DB
- Eliminate candidates that are infrequent, leaving only those that are frequent
- Sampling — Divide the provided dataset into N datasets either random or using some pattern or shuffling. Repeat execution with multiple random datasets. Compare the Rules generated
- Data processing — Apply Discretization, cleaning on the dataset to remove noisy transactions.
- Generate Item set for the provided transactions with 60% Min Support.
Support(A) = (Transactions containing (A))/(Total Transactions)
Published at DZone with permission of Ritresh Girdhar. See the original article here.
Opinions expressed by DZone contributors are their own.