X = np.concatenate([np.random.randn(3, 10), np.random.randn(2, 10) + 100])
model = AgglomerativeClustering(linkage='average', affinity='cosine')
model.fit(X)
How to traverse a tree from sklearn AgglomerativeClustering?