For the given sets of length k, returns combined candidate sets of length k+1.
(self, sets)
| 1218 | return [frozenset([v]) for v in set(chain(*sets))] |
| 1219 | |
| 1220 | def Ck(self, sets): |
| 1221 | """ For the given sets of length k, returns combined candidate sets of length k+1. |
| 1222 | """ |
| 1223 | Ck = [] |
| 1224 | for i, s1 in enumerate(sets): |
| 1225 | for j, s2 in enumerate(sets[i+1:]): |
| 1226 | if set(list(s1)[:-1]) == set(list(s2)[:-1]): |
| 1227 | Ck.append(s1 | s2) |
| 1228 | return Ck |
| 1229 | |
| 1230 | def Lk(self, sets, candidates, support=0.0): |
| 1231 | """ Prunes candidate sets whose frequency < support threshold. |