<p>Have you taken a look at <a href="https://en.wikipedia.org/wiki/Hierarchical_clustering" rel="nofollow noreferrer">hierarchical clustering</a> algorithms? You can choose among several distance metrics and use a <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.dendrogram.html" rel="nofollow noreferrer">dendrogram</a> to visualize the various splits. Standard packages like <a href="https://scikit-learn.org/stable/modules/clustering.html#hierarchical-clustering" rel="nofollow noreferrer">scikit-learn</a> &amp; <a href="https://docs.scipy.org/doc/scipy/reference/cluster.hierarchy.html" rel="nofollow noreferrer">Scipy</a> have a number of common hierarchical clustering algorithms/visualization tools.</p>

CC BY-SA 4.0
2021-06-22T20:41:11.763Z
Yes, but actually I think it does not fit my need : in this case, it build the tree on one of two options (so age or country first) but then it won't split, so I won't see the two alternative yet correct clusterings (age / origin)
Vincent
CC BY-SA 4.0
2021-06-22T16:23:19.687Z
2021-06-22T16:23:19.687Z
rahulmehta95
<p><em><strong>Illustrate the question with an example</strong></em> : we have a similarity matrix for 1000 people, and the similarity represents how much their <em>hobbies</em> are the same (it does not really matter how it's built).</p>
<p>Let's say that among these people :</p>
<ul>
<li>50% are 15 years old and 50% are 60 years old ;</li>
<li>At the same time, 33% are American, 33% are European, and 34% are Asian.</li>
</ul>
<p>Now if we run a <em><strong>clustering algorithm</strong></em> on this dataset.</p>
<ul>
<li>with k = 2, groups are divided based on their age (younger / older);</li>
<li>with k = 3, groups are divided based on their place of origin (US, Europe, Asia), and the cluster allocation is very different from k = 2 : many <em>couples</em> together in k = 2 are separate with k = 3 and vice versa.</li>
<li>and with k = 6, groups are divided on both age and region (young US, young EU, ...)</li>
</ul>
<p>I find it interesting to realize that :</p>
<ul>
<li>clusters with k = 2 and k = 3 are the most different</li>
<li>cluster with k = 6 merge both</li>
</ul>
<p><strong>My question is the following :</strong></p>
<p>On a more complex dataset, how to detect automatically this &quot;<em>tree-like shape</em>&quot; of the &quot;<em>most different clustering paths</em>&quot; ? In the current example it would be to detect that k = 2 and k = 3 are the two most different yet interesting clusterings; and that k = 6 is a parent of both.</p>
<p>I am having trouble doing bibliography on this, I tried keywords like &quot;trees&quot;, &quot;consensus&quot;, &quot;most different&quot; clustering, but I didn't find an answer.</p>
<p>Honestly I can't believe I am the first one to ask this question, I guess I just don't know how to formulate it correctly.</p>
<p>Edit : Maybe &quot;alternative clustering&quot; is the keyword I am looking for</p>

<ds.algorithms><ds.data-structures><clustering>
How to build the tree with the "most different" solutions of a clustering?
Vincent
# How to build the tree with the "most different" solutions of a clustering?

(Asked by: username_0 on 2021-06-22)

***Illustrate the question with an example*** : we have a similarity matrix for 1000 people, and the similarity represents how much their *hobbies* are the same (it does not really matter how it's built).

Let's say that among these people :

* 50% are 15 years old and 50% are 60 years old ;
* At the same time, 33% are American, 33% are European, and 34% are Asian.

Now if we run a ***clustering algorithm*** on this dataset.

* with k = 2, groups are divided based on their age (younger / older);
* with k = 3, groups are divided based on their place of origin (US, Europe, Asia), and the cluster allocation is very different from k = 2 : many *couples* together in k = 2 are separate with k = 3 and vice versa.
* and with k = 6, groups are divided on both age and region (young US, young EU, ...)

I find it interesting to realize that :

* clusters with k = 2 and k = 3 are the most different
* cluster with k = 6 merge both

**My question is the following :**

On a more complex dataset, how to detect automatically this "*tree-like shape*" of the "*most different clustering paths*" ? In the current example it would be to detect that k = 2 and k = 3 are the two most different yet interesting clusterings; and that k = 6 is a parent of both.

I am having trouble doing bibliography on this, I tried keywords like "trees", "consensus", "most different" clustering, but I didn't find an answer.

Honestly I can't believe I am the first one to ask this question, I guess I just don't know how to formulate it correctly.

Edit : Maybe "alternative clustering" is the keyword I am looking for

**Tags:** ds.algorithms, ds.data-structures, clustering

---

## 1 answers

### Answer by username_1 on 2021-06-22. Score: 1

Have you taken a look at [hierarchical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering) algorithms? You can choose among several distance metrics and use a [dendrogram](https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.dendrogram.html) to visualize the various splits. Standard packages like [scikit-learn](https://scikit-learn.org/stable/modules/clustering.html#hierarchical-clustering) & [Scipy](https://docs.scipy.org/doc/scipy/reference/cluster.hierarchy.html) have a number of common hierarchical clustering algorithms/visualization tools.

> **Comments:**
> **username_0**: Yes, but actually I think it does not fit my need : in this case, it build the tree on one of two options (so age or country first) but then it won't split, so I won't see the two alternative yet correct clusterings (age / origin)  

---

