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

Method __call__

pattern/vector/__init__.py:1241–1259  ·  view source on GitHub ↗

Returns a dictionary of (set(features), frequency)-items. The given support (0.0-1.0) is the relative amount of documents in which a combination of feature must appear.

(self, sets, support=0.5)

Source from the content-addressed store, hash-verified

1239 return dict((s, f) for s, f in Lk.items() if f >= support)
1240
1241 def __call__(self, sets, support=0.5):
1242 """ Returns a dictionary of (set(features), frequency)-items.
1243 The given support (0.0-1.0) is the relative amount of documents
1244 in which a combination of feature must appear.
1245 """
1246 C1 = self.C1(sets)
1247 L1 = self.Lk(sets, C1, support)
1248 self._candidates = [L1.keys()]
1249 self._support = L1
1250 while True:
1251 # Terminate when no further extensions are found.
1252 if len(self._candidates[-1]) == 0:
1253 break
1254 # Extend frequent subsets one item at a time.
1255 Ck = self.Ck(self._candidates[-1])
1256 Lk = self.Lk(sets, Ck, support)
1257 self._candidates.append(Lk.keys())
1258 self._support.update(Lk)
1259 return self._support
1260
1261apriori = Apriori()
1262

Callers

nothing calls this directly

Calls 7

C1Method · 0.95
LkMethod · 0.95
CkMethod · 0.95
lenFunction · 0.85
keysMethod · 0.45
appendMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected