MCPcopy Index your code
hub / github.com/clips/pattern / Ck

Method Ck

pattern/vector/__init__.py:1220–1228  ·  view source on GitHub ↗

For the given sets of length k, returns combined candidate sets of length k+1.

(self, sets)

Source from the content-addressed store, hash-verified

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.

Callers 1

__call__Method · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected