Commit e34ff8c
committed
Apriori: implement join step of apriori-gen
The apriori-gen function described in section 2.1.1 of Apriori paper
has two steps; first, the join step looks for itemsets with the same
prefix, and creates new candidates by appending all pairs combinations
to this prefix. Here is pseudocode copied from paper:
select p.1, p.2, ..., p.k-1, q.k-1
from p in L(k-1), q in L(k-1)
where p.1 = q.1, ..., p.k-2 = q.k-2, p.k-1 < q.k-1
The reason is that if a sequence q with the same prefix as p does not
belong to L(k-1), itemset p+(q.k-1,) cannot be frequent.
Before this commit, we were considering p+(q.k-1,) for any q.k-1 > p.k-1.
The second step of apriori-gen function is called prune step, it will
be implemented in a distinct commit.
See discussion in #644.1 parent 1308f6b commit e34ff8c
1 file changed
+15
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
0 commit comments