Closed PaulLerner closed 4 years ago
This is a bug in pyannote.pipeline.blocks.clustering
(I transfered the issue).
Before calling linkage
, __call__
should check whether there is strictly more than one element to cluster. It should also handle the corner case where there is exactly one element (i.e. return trivial clustering result without calling linkage).
I'd happily merge a pull request fixing both HierarchicalAgglomerativeClustering
and AffinityPropagationClustering
ValueError: The number of observations cannot be determined on an empty distance matrix
Hi, I'm getting this error from scipy, it relates to this line. This is happening when using the
SpeechTurnClustering
Pipeline withHierarchicalAgglomerativeClustering
, as it computelinkage
which itself computespdist
andscipy.cluster.hierarchy.linkage
The error happens because when there's only one embedding inX
(input oflinkage
), the distance matrixdistance = pdist(X, metric=metric)
is empty (i.e. has a shape of 0)Full output: