Révision 78fcb188 modules/clustering.py
b/modules/clustering.py | ||
---|---|---|
13 | 13 |
clustering: Directs the clustering process by calling the relevant functions. |
14 | 14 |
""" |
15 | 15 |
import logging |
16 |
import warnings |
|
17 | 16 |
|
18 | 17 |
import hdbscan |
19 | 18 |
import numpy as np |
... | ... | |
125 | 124 |
exemplars = [] |
126 | 125 |
for i, mtx in enumerate(clust_affty_mtcs): |
127 | 126 |
pref = -1e6 * np.max(np.abs(mtx)) |
128 |
warnings.filterwarnings("error") |
|
129 |
try: |
|
130 |
af = AffinityPropagation(affinity='precomputed', preference=pref, |
|
131 |
damping=0.95, max_iter=2000, |
|
132 |
random_state=None).fit(mtx) |
|
133 |
except UserWarning as w: |
|
134 |
logger.warning(str(w)) |
|
127 |
af = AffinityPropagation(affinity='precomputed', preference=pref, |
|
128 |
damping=0.95, max_iter=2000, |
|
129 |
random_state=None).fit(mtx) |
|
135 | 130 |
exemplars.append(clusters[i][af.cluster_centers_indices_[0]]) |
136 | 131 |
return exemplars |
137 | 132 |
|
Formats disponibles : Unified diff