3

What's the data argument for seaborn clustermap.

Does it take a matrix where each cell is the distance between the vectors of the original matrix with observations? Or the clustermap calculates the distance itself so that I need to pass the observation matrix?

In the first case, what the argument metric is there for? Is there to indicate which metric has been used to calculate the distances?

foebu
  • 1,365
  • 2
  • 18
  • 35
  • 1
    This [answer](http://stackoverflow.com/a/38858404/1628638) of mine gives details of the distance calculation in `clustermap()`. – Ulrich Stern Aug 10 '16 at 17:39

1 Answers1

2

Obviously - look at the ''examples'' on the very page you linked - it expects a data table, and a metric to use for computing distances.

As the documentation of clustermap clearly states, it uses scipy.spatial.distance.pdist to compute pairwise distances.

I do not seen an option to use a precomputed distance matrix, although it may be possible to pass a custom function that could do a matrix lookup.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
  • Then there is something that I don't understand, why in the example where the the cluster is retrieved calculating a cosine metric we have a scale between 0 and 600? Isn't the cosine bound between -1 and 1? What am I missing? – foebu Jan 07 '16 at 15:58
  • The color is not the distance, but the input data. – Has QUIT--Anony-Mousse Jan 07 '16 at 17:32