From ed1379f4fcd8dffdf99cdf9f4dd563b77c7e31b5 Mon Sep 17 00:00:00 2001 From: Yomguithereal Date: Mon, 2 Jul 2018 21:40:02 +0200 Subject: [PATCH] Draft --- fog/clustering/pairwise.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fog/clustering/pairwise.py b/fog/clustering/pairwise.py index cd876ef..c32d48b 100644 --- a/fog/clustering/pairwise.py +++ b/fog/clustering/pairwise.py @@ -367,6 +367,25 @@ def pairwise_connected_components(data, similarity=None, distance=None, radius=N sets.union(i, j) # Iterating over components + cindex = {} + + # TODO: add this as a sparse option to phylactery + # for i, parent in enumerate(sets.parents): + # p = sets[i] + + # if sets.cardinalities[p] < min_size: + # continue + + # c = cindex.get(p) + + # if c is None: + # cindex[p] = [data[i]] + # else: + # c.append(data[i]) + + # for cluster in cindex.values(): + # yield cluster + for component in sets.components(min_size=min_size, max_size=max_size): yield [data[i] for i in component]