Content deleted Content added
m →Overview: removed external link |
Citation bot (talk | contribs) Add: doi, pages. | Use this bot. Report bugs. | Suggested by Dominic3203 | Linked from User:LinguisticMystic/cs/outline | #UCB_webform_linked 93/2277 |
||
(45 intermediate revisions by 35 users not shown) | |||
Line 1:
{{Short description|Algorithm for frequent item set mining and association rule learning over transactional databases}}
'''Apriori'''<ref name=apriori>Rakesh Agrawal and Ramakrishnan Srikant
== Overview ==
The Apriori algorithm was proposed by Agrawal and Srikant in 1994. Apriori is designed to operate on [[database]]s containing transactions (for example, collections of items bought by customers, or details of a website frequentation or [[IP address]]es<ref>{{usurped|1=[https://
Apriori uses a "bottom up" approach, where frequent subsets are extended one item at a time (a step known as ''candidate generation''), and groups of candidates are tested against the data. The algorithm terminates when no further successful extensions are found.
Apriori uses [[breadth-first search]] and a [[Hash tree (persistent data structure)|Hash tree]] structure to count candidate item sets efficiently. It generates candidate item sets of length <math>k</math> from item sets of length <math>k-1</math>. Then it prunes the candidates which have an infrequent sub pattern. According to the
The pseudo code for the algorithm is given below for a transaction database <math>T</math>, and a support threshold of <math>\
'''Apriori'''(T, ε)
L<sub>1</sub> ← {large singleton itemsets}
k ← 2
'''while''' L<sub>k−1</sub> '''is not''' empty
C<sub>k</sub> ← Generate_candidates(L<sub>k−1</sub>, k)
'''for''' transactions t '''in''' T
D<sub>t</sub> ← {c in C<sub>k</sub> : c ⊆ t}
'''for''' candidates c '''in''' D<sub>t</sub>
count[c] ← count[c] + 1
L<sub>k</sub> ← {c in C<sub>k</sub> : count[c] ≥ ε}
k ← k + 1
'''return''' Union(L<sub>k</sub>) '''over all''' k
'''Generate_candidates'''(L, k)
result ← empty_set()
'''for all''' p ∈ L, q ∈ L '''where''' p and q differ in exactly one element
c ← p ∪ q
'''if''' u ∈ L '''for all''' u ⊆ c '''where''' |u| = k-1
result.add(c)
'''return''' result
== Examples ==
Line 37 ⟶ 43:
{| class="wikitable"
|-
|-
| α || β ||
|-
| α || β ||
|-
| &alpha
▲| alpha|| beta || theta
|}
The association rules that can be determined from this database are the following:
# 100% of sets with α also contain β
# 50% of sets with α, β also have ε
# 50% of sets with α, β also have θ
we can also illustrate this through a variety of examples.
Line 60 ⟶ 65:
Let the database of transactions consist of following itemsets:
{| class="wikitable"
|-
| {1,2,3,4}
Line 128 ⟶ 133:
We have thus determined the frequent sets of items in the database, and illustrated how some items were not counted because one of their subsets was already known to be below the threshold.
== Limitations ==
Apriori, while historically significant, suffers from a number of inefficiencies or trade-offs, which have spawned other algorithms. Candidate generation generates large numbers of subsets (
The algorithm scans the database too many times, which reduces the overall performance. Due to this, the algorithm assumes that the database is
Also, both the time and space complexity of this algorithm are very high: <math>O\left(2^{|D|}\right)</math>, thus exponential, where <math>|D|</math> is the horizontal width (the total number of items) present in the database.
Later algorithms such as [[Max-Miner]]<ref>{{cite journal|author=Bayardo Jr, Roberto J.|title=Efficiently mining long patterns from databases|journal=ACM SIGMOD Record |volume=27|issue=2|year=1998|pages=85–93 |doi=10.1145/276305.276313 |url=http://www.cs.sfu.ca/CourseCentral/741/jpei/readings/baya98.pdf}}</ref> try to identify the maximal frequent item sets without enumerating their subsets, and perform "jumps" in the search space rather than a purely bottom-up approach.
== References ==
Line 148 ⟶ 152:
* The [[R (programming language)|R]] package [https://cran.r-project.org/package=arules arules] contains Apriori and Eclat and infrastructure for representing, manipulating and analyzing transaction data and patterns.
* [https://github.com/tommyod/Efficient-Apriori Efficient-Apriori] is a Python package with an implementation of the algorithm as presented in the original paper.
|