5

We're required to pass a distance matrix, so there should be no need to calculate any additional distances, right? What am I missing?

Documentation here: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.cluster.hierarchy.linkage.html

elplatt
  • 3,227
  • 3
  • 18
  • 20

2 Answers2

3

The linkage function does not need the metric argument, unlees you pass in your original observations instead of a distance matrix.

From your posted link

y : ndarray
[...] Alternatively, a collection of m observation vectors in n dimensions may be passed as an m by n array.

The linkage function checks, if you passed in a valid distance matrix - presumable using is_valid_y / is_valid_dm - and if not it will first apply pdist with the metric you have specified (and euclidean metric if nothing has been specified).

embert
  • 7,336
  • 10
  • 49
  • 78
  • Is this the correct use of custom distance metric? http://stackoverflow.com/questions/38153829/custom-cluster-colors-of-scipy-dendrogram-in-python-link-color-func – O.rka Jul 06 '16 at 14:48
0

I think the metric is used for calculating the distance between the newly formed cluster ( depending in which method we use)