Commit b90a146
committed
Further improve generate_new_combinations
The apriori-gen function described in section 2.1.1 of Apriori paper
has two steps; the first step had been implemented in 96dfd4d.
The second step of apriori-gen function is called prune step, it takes
candidates c from first step and check that all (k-1) tuples built by
removing any single element from c is in L(k-1).
Efficient lookups require some dedicated data structure; Apriori paper
describes how to do it with hash-trees; it is also possible to use
prefix trees (also knows as tries).
This commit uses third-party pygtrie module, to check whether this step
provides performance improvements in our case. It can then be decided
to either keep this import or write a stripped down implementation.1 parent 680e2d8 commit b90a146
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
54 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
0 commit comments